TACL Reference Manual

Built-In Functions and Variables
HP NonStop TACL Reference Manual429513-018
9-334
#ROUTINENAME Built-In Function
#ROUTINENAME Built-In Function
Use #ROUTINENAME to allow a routine to obtain its own name; the routine can then
use this information to invoke itself.
Result
#ROUTINENAME returns the fully qualified name of the variable level holding the
currently active routine. If invoked from a routine stored in a ?TACL ROUTINE file, it
returns the name of the variable TACL created to hold a copy of the routine while it is
active (it cannot obtain the name of the original file).
Considerations
#ROUTINENAME performs a similar function in TACL routines as %0% performs
in TACL macros (see the detailed descriptions in the TACL Programming Guide of
the differences and similarities between macros and routines). The two features
are not interchangeable, however, as shown by this example.
To invoke the entire routine from within the routine, obtain the routine name by
calling the #ROUTINENAME built-in function.
Examples
Given this library,
?SECTION rumph ROUTINE
#OUTPUT Percents show name as %0%.
#OUTPUT Routinename shows name as [#routinename].
?SECTION grumph MACRO
#OUTPUT Percents show name as %0%.
#OUTPUT Routinename shows name as [#routinename].
invoking the routine and the macro gives these results:
36> RUMPH
Percents show name as %0%.
Routinename shows name as :RUMPH.1.
37> GRUMPH
Percents show name as :GRUMPH.1.
#OUTPUT Routinename shows name as [#routinename]
^
*ERROR* No routine has been called
You can also use #ROUTINENAME to invoke a variable that will reside in the same
directory as the routine itself, without stating the directory name explicitly:
[#VARIABLEINFO /DIRECTORY/ [#ROUTINENAME]]:elf elf-args
#ROUTINENAME