PROGRAM NAME = VARSTATS
HELPER PROG = VARASM
Release Name = Variable Stats

VARSTATS is a simple program that looks up a variable and
indicates whether the variable is defined or not, and if
defined, whether it is archived or not.

VARSTATS Syntax:
:"<Var Name Here>"
:prgmVARSTATS
:Ans-><somewhere>
The reason, you'll want to store Ans to another variable is because
any test on it will change Ans!

Basically, you put the name of the variable you want looked up on its
own line and enclose it with quotes (e.x. "prgmTERM"). Then call
VARSTATS. VARSTATS will call VARASM to do the actual work. VARASM sets
answer to a value according to whether or not it is defined and whether
or not it is archived. (While you can directly call VARASM with the
Asm( syntax, VARSTATS can be used to both display the result on the
homescreen (VARASM just shows Done and you have to do a seperate recall
of Ans) and also allows you to not have to dig through the catalog.)
VARSTATS stores in answer one of the following:
-1 if the variable is not defined (some vars can be defined via store).
0 if the variable is defined and not archived (accessible).
1 if the variable is defined, but archived (must unarc first).
VARSTATS can be used to decide whether or not a variable can be used
in a BASIC program, so that it can avoid errors when a variable it needs
is not present. If a BASIC program, for example, wants to run another
BASIC program as a subroutine, it can call VARSTATS on the program and
if VARSTATS doesn't return 0, the program can't be called (there is no
"normal" way to unarc a program in a program).
There is one other feature, however, available to programs that directly
call Asm(-syntax programs. If you use the Asm( syntax in the input
string (e.x. "Asm(prgmTERMASM)"), VARSTATS will return a different set
of values:
-1 if the program is not defined.
0 if the program is defined, unarchived, and is Asm.
1 if the program is defined, but archived.
-2 if the program is defined and unarchived, but not Asm.
