TACL Reference Manual
Built-In Functions and Variables
HP NonStop TACL Reference Manual—429513-018
9-39
#CASE Built-In Function
#CASE Built-In Function
Use #CASE to return one of a set of alternative text sequences. You provide a set of
labeled options using an enclosure. When TACL evaluates the #CASE statement, it
searches the enclosure for a label that matches some specified text, and returns the
text sequence that follows the label.
text
is the text to be matched to a label in the enclosure; it cannot contain any spaces.
enclosure
is an enclosure consisting of a series of labels and options as follows:
| label-1 | [ option-text-1 ]
| label-2 | [ option-text-2 ]
...
| OTHERWISE | [ option-text-n ]
The OTHERWISE label, if included, must be listed last. For more information about
enclosures, see Section 5, Statements and Programs.
label-num
is a unique label that identifies an option. TACL searches the labels for one
matching the text. All labels must be outside of any square brackets within
enclosure and between vertical bars. A label can be a space-separated list,
allowing several values of text to match a single label.
option-text-num
is a text sequence, typically one or more functions that can be executed when
returned by #CASE.
Result
#CASE returns all option text that follows a selected label; the text is terminated by the
next label or the end of the enclosure. The result includes any spaces or carriage
returns that precede the text. If text does not match any label, #CASE returns the text
following the OTHERWISE label, up to the next label or to the end of the enclosure.
Considerations
•
No label can appear more than once in the enclosure.
•
Label evaluation is not case-sensitive. #CASE treats a label of the form | A a | as a
repetition of the same label, resulting in an error.
#CASE text enclosure