5-78 Command Reference
SWITCH
Purpose Directs script flow by branching to a set of commands based on the value of a
variable.
Syntax SWITCH
buffer-field1
CASE
buffer-field
.
.
.
CASE
buffer-field
.
.
.
DEFAULT
.
.
.
ENDSWITCH
Process The SWITCH command directs script flow by branching to a set of commands
based on the value of a variable. The command compares
buffer-field1
to the
buffer-field
listed with each case command. If the fields are equal, the script
executes the commands following the CASE command. Execution stops when the
script reaches the next CASE, DEFAULT, or ENDSWITCH.
If no
buffer-field
fields match
buffer-field1
, the script executes the set of commands
after DEFAULT.
NOTE: There is no BREAK command to terminate CASE blocks, so this command does not
support CASE fall-through. Also, Do Not use SWITCH inside a macro.
The
buffer-field
fields can be one of the following:
Buffer-field
Description
INPUT Input Buffer
Logical Field Name
(TEMP1)
Temporary Buffer
Field
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Number
String
Number prefixed by a
number sign (#)
ASCII string delimited
by double quotes.
Must be one
character long