Programming Guide |
Declares JPL variables
varsvarSpec
[,varSpec
]...
Specifies the variable's name and properties as follows:
varName
[[numOccurs
]] [(size
)] [=initValue
]
varName
- The name of the variable, where
varName
is a string that contains up to 31 characters. JPL variable names can use any combination of letters, digits, or underscores, where the first character is not a digit. Panther also allows usage of two special characters, the dollar sign ($) and period (.).- [
numOccurs
]- Optionally declares
varName
as an array ofnumOccurs
occurrences. The default number of occurrences is 1. For example the following statement declares dependents as an array of ten occurrences:vars dependents[10]
- (
size
)- Optionally specifies the number of bytes allocated for this variable; Panther allocates an extra byte for the terminating null character. The default size is 255 bytes. For example, the following statement declares the variable zip with a size of 10 bytes:
vars zip (10)- =
initValue
- Optionally initializes the variable to
initValue
, whereinitValue
can be any constant, variable, or string or numeric expression. For example:vars workweek = 5
vars avg_sale = @sum(sale_amt) / sale_amt->num_occurrences
vars name = fname##lnameIf the variable is declared as an array, you can initialize its occurrences. For example:
vars ratings[5] = {"G", "PG", "PG-13", "R", "NC-17"}Occurrence values are comma-delimited.
If no value is assigned, Panther initializes the variable to an empty string ("").
The
vars
command creates one or more JPL variables. Panther executesvars
statements as it encounters them at runtime. JPL's ability to reference a variable depends on the variable's scope and lifetime:
- Variables declared in a named procedure are known only to that procedure and remain in memory until the procedure returns.
vars name(50), flag(1)
vars address[3](50), abbrevs[10]
vars zip(5) = "02138"
global