TACL Reference Manual
Variables
HP NonStop TACL Reference Manual—429513-018
4-8
Macro Arguments
For information about TACL statements, see Section 5, Statements and Programs. For
additional examples of TACL macros, see the TACL Programming Guide.
Macro Arguments
A macro accesses arguments by position. To access an argument, specify the
position, enclosed in percent signs (% n%). For example, %1% references the first
argument supplied when the variable is invoked. Table 4-4 lists several ways to access
macro arguments from within a macro.
When you invoke a macro, you supply arguments as a space-separated list. TACL
substitutes the real arguments in place of the dummy arguments. If you supply more
arguments than are used in the macro, TACL ignores the extra arguments.
Because of the use of the percent sign to denote dummy arguments, if you want to
include a literal percent sign in a macro, enter it twice (%%).
Sample Declarations
This code defines a macro called fn that calls FILENAMES with the first argument
supplied to fn:
?SECTION fn MACRO
FILENAMES %1%
If the argument is not a file-name template, TACL returns an error. You could also use
#DEF to define this macro:
[#DEF fn MACRO |BODY| FILENAMES %1%]
Table 4-4. Macro Arguments
Argument Form Description
%0% The name of the macro itself
%n% The nth argument supplied by the user
%n1 TO n2% The range of arguments from n1 to n2
%n1 to *% The range of arguments from n1 up to and including the last
argument
%n1 TO n2 BY n3% The range of arguments from n1 up to and including n2, using the
increment n3 to step through the specified portion of the list (For
example, %1 TO * BY 2% selects all odd-numbered arguments.)
%n1 TO * BY n3% The range of arguments from n1 up to and including the last
argument, using the increment n3 to step through the specified
portion of the list
%*% All arguments