TACL Reference Manual

Variables
HP NonStop TACL Reference Manual429513-018
4-11
Comparing Argument Handling in Macros and
Routines
]
#UNFRAME
The SINK commands discard the results of #ARGUMENT and prevent TACL from
echoing to the TACL OUT file. A successful evaluation returns 1; otherwise, the routine
terminates with an error. You could also use a #SET call to evaluate the results.
Comparing Argument Handling in Macros and Routines
These examples show the difference in argument processing between macros and
routines.
This is a sample macro:
?TACL MACRO
== This macro does not check syntax or existence of
== file^name.
#FRAME
#PUSH file^name
#SET file^name %1%
#OUTPUT File name is [file^name]
#UNFRAME
The macro processes whatever it is given (even if no argument is supplied) and
outputs what it is given. Separate coding is required to validate arguments. If you store
this macro in a file named HEYMAC, TACL produces this when you run HEYMAC:
39 HEYMAC thisfile
File name is thisfile
This is a sample routine that performs a similar function:
?TACL ROUTINE
== This routine returns an error if there is no argument,
== if the argument does not have correct syntax, or
== if the named file does not exist.
#FRAME
#PUSH file^name
SINK [#ARGUMENT /VALUE file^name/ FILENAME]
#OUTPUT File name is [file^name]
#UNFRAME
If you store the routine in a file named ROOTN, TACL produces this when you run
ROOTN:
40 ROOTN thatfile
File name is \NODE.$VOL.SUBVOL.THATFILE
The #ARGUMENT function in the routine requires a file name, so TACL checks that:
An argument is present in the function call
The argument has proper syntax for a file name
A file with the specified name actually exists