TACL Reference Manual
Variables
HP NonStop TACL Reference Manual—429513-018
4-10
Sample Declaration
exist to be a valid file-name argument, but if you specify SYNTAX, TACL checks only
for correctness of the file-name syntax.)
If the argument matches a listed type, the argument is placed into a specified variable,
and TACL returns a number that indicates the argument type. If the argument does not
fit any of the specified types, the routine terminates and generates an error message,
listing the types of arguments that were expected.
To parse arguments to a routine, use the #ARGUMENT built-in function. The
#ARGUMENT function allows you to define the types of arguments that can be
processed by the routine. TACL searches this list from left to right when it processes
each argument and returns the position (in the list) of the first argument type that
matches the argument.
If you declare variables within the routine, surround their declaration and use with
#FRAME and #UNFRAME calls, TACL deletes the variables before you exit the
routine.
Sample Declaration
This code defines a routine variable called day_of_the_week that contains a series of
TACL statements. The routine accepts a timestamp as its argument; the argument is
optional:
?SECTION day_of_the_week ROUTINE
#FRAME
#PUSH days timestamp rslt
== Accept one argument that is a timestamp.
#SET rslt [#ARGUMENT /VALUE timestamp/ NUMBER END]
[#CASE [rslt]
|1| SINK [#ARGUMENT END] == A valid timestamp was supplied
|2| == No timestamp; use the current timestamp:
#SET timestamp [#TIMESTAMP]
|OTHERWISE|
== Unexpected value from #ARGUMENT
#OUTPUT Invalid argument
#UNFRAME
#RETURN
]
== Calculate the numbers of days since 0 and since
== the beginning of the week
#SET days [#COMPUTE [timestamp]/(24*60*60*100) ]
== Return the day of the week.
#SET days [#COMPUTE days - ((days/7) * 7)]
#RESULT [#CASE [days]
|0| Tuesday
|1| Wednesday
|2| Thursday
|3| Friday
|4| Saturday
|5| Sunday
|6| Monday