TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-28
#ARGUMENT Built-In Function
If you omit both QUALIFIED and UNQUALIFIED, a variable name is
acceptable with or without a level number.
WORD [ / SPACE / ]
matches all text up to the next comma, slash, semicolon, space, left or right
parenthesis, or end-of-line. If you include the SPACE option, space and end-of-
line are the only delimiters.
Result
#ARGUMENT returns the position number of the alternative that matches the type of
the routine argument being examined.
Considerations
#ARGUMENT can appear only in a routine.
If the routine argument does not match any of the alternatives tested for by
#ARGUMENT, the TACL error handler takes over. If you include the OTHERWISE
alternative, however, no error can occur; you must construct your own error-
checking mechanism to deal with invalid arguments.
If the call to a routine is issued from the IN file or is loaded under control of a
?FORMAT directive in a library file, the setting of the #INFORMAT built-in variable
has an effect on the way arguments are processed. This is summarized in
Table 9-3. In each case, the #ARGUMENT function is expecting a STRING
argument. For sake of example, the variable SV is presumed to contain the text
SUBVOL. and the variable FN contains FILENAME.
Under control of PLAIN format, TACL does not recognize square brackets as
metacharacters, so does not invoke the variable. Under QUOTED format, the quotation
marks instruct TACL to treat the square brackets as ordinary text.
For arguments not affected by #INFORMAT, the TEXT and VALUE options behave in
the same way as shown for TACL input format.
The identity of the alternative being tested can have an effect on the result of the
VALUE option. For example, suppose that in addition to the variable FN, above,
there were a file of the same name. Using a single argument, the VALUE option
could return different results depending on which type of argument is expected;
examples of this are shown in Table 9-4
on page 9-29.
Table 9-3. Effect of #INFORMAT on Argument Processing
#INFORMAT Argument Text Value
Plain or quoted sv’+’”[fn]” sv’+’”[fn]” SUBVOL.[fn]
TACL sv’+’”[fn}” sv’+’”FILENAME” SUBVOL.FILENAME