Action Statement
Perform pattern matching on a string value.
switch STRING_VALUE is
case {char|line}
[col NUM1 [thru NUM2]]{STRING|word|number|blank} is
[ACTION_STATEMENT] ...
[case {char|line}
[col NUM1 [thru NUM2]]{STRING|word|number|blank} is
[ACTION_STATEMENT] ...] ...
default is
[ACTION_STATEMENT] ...
end switch
STRING_VALUE
An expression that is converted to a string value.
case char
A character that must appear in the input.
case line
A line that must appear in the input.
col NUM1
The exact column position in which the first character of the specified input must appear.
col NUM1 thru NUM2
Specifies the range of column numbers in which all the characters in the specified input must appear.
NUMn
A compile-time integer value in the range 1-254, representing a column position in the input stream.
STRING
Any compile-time string value that must appear in the input. The string must be a literal (in quotation marks) or a string constant. The string must be contiguous.
word
A word must appear in the input. A word is any contiguous group of ASCII characters, including digits but not including blanks, control characters, or delete characters.
number
A number must appear in the input. A number is a decimal integer, consisting of any digits, optionally preceded by a sign (+ or -) or leading blanks. Embedded blanks, commas, and decimal points are not allowed in numbers. Note that floating point numbers are not taken.
blank
A blank character must appear in the input.
default
The case statement(s) you want executed. All switch statements must include a default statement, which cannot be followed by any other case statements.
ACTION_STATEMENT
An action statement.
Description
Only the first case that matches the pattern will be executed. If no case matches, the default action statement(s) will be executed.
The default case is required, and it must be the last case specified. It does not need an action statement, but it cannot be omitted.
Example
switch (ApplVar_SV) is
case char "bad transmission" is
...
case char "enter name" is
...
case char "more data" is
...
default is
...
end switch