Using REXX EXECs
This chapter includes the following topics:
Call FormatLink copied to clipboard
The following formats can be used to call the REXX EXEC for site standards and enforcement:
-
Function call
CopyCopied to clipboardvar = CTJRXX("function","%%variable = value")
-
ADDRESS
CopyCopied to clipboardADDRESS JVER("function","%%variable = value")
-
The function call format is mandatory for the initial call CTJRXX("INIT"), since it sets up the support for ADDRESS JVER format. After the initialization, either format can be used.
-
The following functions are supported only under ENFORCEMENT rules:
ENFORCE, IBEFORE, IAFTER, DELREC
Tab.JV.5.1 REXX EXEC call functions
Function |
Description |
---|---|
INIT |
Initiates the JVER environment under the REXX environment. Format: CopyCopied to clipboard
|
SETVAR |
Sets local variables, which can be used later in other DO REXX actions or even in any other DO action. Formats: CopyCopied to clipboard
|
SYSINREAD |
Reads data from SYSIN statements (in-stream, PDS members, and sequential files). Formats: CopyCopied to clipboard
where varname - is the name of the stem variable After the execution: %%varname.0 - holds the number of records read %%varname.1 - holds the first data record (80 chars) lines - maximum number of lines to read start - number indicating the first line to read To read the entire SYSIN, “lines start” can be omitted and the following call can be used: CopyCopied to clipboard
The function returns the following return codes:
CopyCopied to clipboard
|
DOMSG |
Issues a JVER message in the JVER report, similar to DO MSG in the site standards. Formats: CopyCopied to clipboard
where:
|
ADJMSG |
Suppresses JVER messages or changes their severity in a dynamic manner. Formats: CopyCopied to clipboard
where:
If suppress is set to Y, severity is not required (and, if specified, is ignored). |
DORC |
Sets the JVER return code (RC) and reason code (RS) of the JVER report, similar to DO RETURN in the site standards. Formats: CopyCopied to clipboard
|
RESOLVE |
Resolves a local, system, or data variable, and gets its value. Format: CopyCopied to clipboard
|
ENFORCE |
Assigns a value to a variable. Applicable only for enforcement rules and the enforcement process. Format: CopyCopied to clipboard
Where %%X is a user defined variable or global AutoEdit variable. The variables that can be set are only those that belong to the current statement. |
IBEFORE |
Insert a new record before the current statement. Applicable only for enforcement rules and the enforcement process. Format: CopyCopied to clipboard
Where rec is the new record to be inserted, limited to the first 72 characters. |
IAFTER |
Insert a new record after the current statement. Applicable only for enforcement rules and the enforcement process. Format: CopyCopied to clipboard
Where rec is the new record to be inserted, limited to the first 72 characters. |
DELREC |
Deletes the current statement. Applicable only for enforcement rules and the enforcement process. Format: CopyCopied to clipboard
|
Example 1
In the following example, REXX user exit is initiated and then the jobname is retrieved with the RESOLVE function. When the jobname is K68 the following message is printed out: INFORMATION: THE JOBNAME IS K68.
Fig.JV.5.1 Example 1 of REXX call
/* REXX */
I = CTJRXX("INIT")
A = CTJRXX("RESOLVE","%%$JOBNAME")
IF A = "K68" THEN DO
M = CTJRXX("DOMSG","I","THE JOBNAME IS K68")
END
RETURN
Example 2
The index values %%$JCLCURF and %%$JCLCURL can be used to access the JCL cards of the current JCL statement by combining %%$JCL with the index as in the following REXX sample:
Fig.JV.5.2 Example 2 of REXX call
/* REXX */
INIT = CTJRXX("INIT")
REC_NUM = CTJRXX("RESOLVE","%%$JCLCURF")
LAST = CTJRXX("RESOLVE","%%$JCLCURL")
DO WHILE REC_NUM <= LAST
TEMP = CTJRXX("RESOLVE","%%$JCL"REC_NUM)
SAY TEMP
REC_NUM = REC_NUM + 1
END
RETURN
Example 3
Using %%$ORIGIN we can verify if the parameters were added by the user, as shown in the following REXX sample:
Fig.JV.5.3 Example 3 of REXX call
/* REXX */
INIT = CTJRXX("INIT")
REC_NUM = CTJRXX("RESOLVE","%%$JCLCURF")
LAST = CTJRXX("RESOLVE","%%$JCLCURL")
DO WHILE REC_NUM <= LAST
TEMP = CTJRXX("RESOLVE","%%$JCL"REC_NUM)
SAY TEMP
REC_NUM = REC_NUM + 1
END
RETURN
Example 4
In the following example, REXX user exit is initiated and then the program name and DD card name are retrieved with the RESOLVE function. When the DD name is TTCNTL and it is used under PGM=IEF000, message CTJD05W, "DSN not found," is suppressed.
Fig.JV.5.4 Example 4 of REXX call
/* REXX */
I = CTJRXX("INIT")
PGM = CTJRXX("RESOLVE","%%$EXECPROG")
DDNM = CTJRXX("RESOLVE","%%$DDNAME")
IF PGM = "IEF000" AND DDNM = "TTCNTL" THEN DO
M = CTJRXX("ADJMSG","CTJD05W","Y","I")
END
RETURN