Program Structure 4-3

Printer Definition

The printer buffer is used to store data to print.
Rule: The field lengths in the printer buffer must equal the length of the largest
corresponding field in the formats. For example, if...
the length of Field 1 of Format 1 is 7
the length of Field 1 of Format 2 is 22
the length of Field 1 of Format 3 is 12
Then, the first field's length in the printer buffer must be 22.

Arrays

You can use an array to store data similar to temporary storage. An array is a series of elements
with the same data type. Arrays can be either numeric or alphanumeric. You can access an element
of an array by providing the array name and an index value. This index value can be a numeric
literal, a numeric buffer-field, or the input buffer. For example, Prices [4] points to the Prices array's
fourth element.
In addition to the information for the DEFINE command listed above, you must also list the number of
elements in the array (the maximum index value). See Chapter 5, "Command Reference," for more
information.
Scope of Field Names
Keep in mind the following information.
You can access all variables globally.
Field names and labels can be up to 255 characters long. However, the first 12 characters must
be unique.
Script Flow Control
You can branch the flow of command control in different ways. The order in which the commands
appear in the script controls the program's flow. At times, control is passed to another command
through the use of valid labels, invalid labels, and the JUMP command. See Chapter 5, "Command
Reference," for information about JUMP.
When a command fails, control passes to an invalid label, if you defined one. For example, the
invalid label may show a message on the printer display. If the script does not identify an invalid
label, control passes to the next line following the executing command. Similarly, when execution is
successful, control passes to a valid label, if you defined one. And, if you did not define a valid
label, control passes to the next line.
Rule: Precede all valid and invalid labels by an asterisk, (*). For example,
ADD CONTROL , TEMP1 , *ERROR2, *SUCCESS2