Workload Automation Programming Language functions
Some commands in Workload Automation Programming Language operate in REXX mode. These
commands are CONSOLE
, DISPLAY
,
DO
, IF
, LOG
,
SETVAR
when the equal sign (=) is used, and WRITE.
REXX mode allows Workload Automation Programming Language to take advantage of REXX functions and expressions, meaning that you can take advantage of both Workload Automation Programming Language and REXX functions. For more information about REXX expressions and functions, see the REXX reference manual.
Workload Automation Programming Language provides you with some functions, prefixed with the at sign (@), that you can use as part of an expression. However, you cannot use any REXX functions or expressions within the functions with the @ prefix. Like Workload Automation Programming Language variables, the functions with the @ prefix are resolved within quotes, before the command is run.
VARSET MYVAR2 = SUBSTR(“!MYVAR1”,2,1
com.VAR.
prefix, as in the following example:
VARSET MYVAR2 = SUBSTR(com.VAR.MYVAR1,2,1)
The REXX versions of Workload Automation Programming Language variables are not resolved
before running, and must follow REXX variable rules (for example, not being included within
quotes). If a variable was not created or referenced by Workload Automation Programming Language ahead of using the
com.VAR
syntax, it will not search for the variable and return
nothing.
As well as the functions with the @ prefix, Workload Automation Programming Language also provides additional functions that you can use together with REXX variables and expressions, with full nesting permitted.
Extending Workload Automation Programming Language by writing your own functions
For commands able to exploit the REXX interpreter, you can write your own functions in REXX to extend the capabilities of Workload Automation Programming Language. You do this by writing a REXX function routine, saving it in a member with the same name as the function, and including it in the SYSPROC concatenation.
The function can perform only REXX functions, it cannot reference any Workload Automation Programming Language commands or features. Such functions can perform string manipulation, or mathematical calculations and return a value back to Workload Automation Programming Language.
MYFUNC
to add the
<
and >
signs to either end of the string
that is passed to it:/* REXX */
PARSE ARG in_String
RETURN "<"||in_String||">"
VARSET
in the same way as any REXX
function:11/21 07.25.28 EQQI200I VARSET FC = MYFUNC("WORLD")
11/21 07.25.28 EQQI033A Variable FC set to "<WORLD>"
11/21 07.25.28 EQQI299I Statement completed - RC=0
- The REXX function can be compiled or interpreted.
- The REXX function is loaded from the library every time it is called in a single running, therefore ensure good performance for the library if it is to be called many times.