Start REXX Procedure (STRREXPRC)

The Start REXX Procedure (STRREXPRC) command calls the interpreter, explicitly specifying the library, file, and source member to interpret.

Parameters

Keyword Description Choices Notes
SRCMBR Source member Name Required, Positional 1
SRCFILE Source file Qualified object name Optional
Qualifier 1: Source file Name, QREXSRC
Qualifier 2: Library Name, *LIBL, *CURLIB
PARM Parameters Character value, *NONE Optional
CMDENV Command environment Single values: *COMMAND, *CPICOMM, *EXECSQL
Other values: Qualified object name
Optional
Qualifier 1: Command environment Name
Qualifier 2: Library Name, *LIBL, *CURLIB
EXITPGM Exit program Single values: *NONE
Other values (up to 8 repetitions): Element list
Optional
Element 1: Program Qualified object name
Qualifier 1: Program Name
Qualifier 2: Library Name, *LIBL, *CURLIB
Element 2: Exit code 2, 3, 4, 5, 7, 8, 9, 10

Source member (SRCMBR)

Specifies the name of the source file member that contains the REXX procedure to be started.

This is a required parameter.

Source file (SRCFILE)

Specifies the source file that contains the REXX procedure to be started.

Qualifier 1: Source file

QREXSRC
The IBM-supplied source file, QREXSRC, contains the REXX procedure.
name
Specify the name of the source file that contains the REXX procedure to be run.

Qualifier 2: Library

*LIBL
The library list is used to locate the source file.

When *LIBL is specified for this qualifier, REXX will find the first source file in the library list with the specified source file name. If a source file is found, REXX will look for the source member in only that source file. REXX will not continue looking for any other source files by the same name in the library list. This is the default REXX source file member search behavior.

You can change how REXX searches for the source file member by adding a job-level environment variable named QIBM_REX_FIND_SRCMBR. You would use the Add Environment Variable (ADDENVVAR) command and specify ENVVAR(QIBM_REX_FIND_SRCMBR) and LEVEL(*JOB).

  • If the initial value (VALUE parameter) specified on the ADDENVVAR command is *BYMBRNAME, REXX will search for the source member by looking in each source file with the specified file name in the library list that contains a source member with the name specified for the Source member (SRCMBR) parameter.
  • If the initial value specified on the ADDENVVAR command is *BYFILENAME or any other value, or if the environment variable does not exist, the default REXX source file member search behavior is used.
*CURLIB
The current library is used to locate the source file. If no library is specified as the current library for the job, QGPL is used.
name
Specify the name of the library where the source file is located.

Parameters (PARM)

Specifies procedure parameter values passed to the REXX procedure when it is started. These values are accessed through the argument (ARG) instruction within the REXX procedure.

*NONE
There are no procedure parameters for the REXX procedure. The ARG instruction returns a null string.
character-value
Specify the procedure parameter value to pass to the REXX procedure. A maximum of 3000 characters is allowed.

Command environment (CMDENV)

Specifies the initial command environment program to process commands embedded in the REXX procedure. The REXX interpreter will call this environment whenever a command is encountered within the REXX procedure.

Single values

*COMMAND
The IBM i control language (CL) command environment is used.
*CPICOMM
The Common Programming Interface (CPI) for Communications command environment is used.
*EXECSQL
The Structured Query Language (SQL) Command environment is used. EXECSQL is the command environment used for CL commands that are imbedded within a REXX procedure.

Qualifier 1: Command environment

name
Specify the name of the program to process commands embedded in the REXX procedure.

Qualifier 2: Library

*LIBL
The library list is used to locate the program.
*CURLIB
The current library for the job is used to locate the program. If no library is specified as the current library for the job, QGPL is used.
name
Specify the name of the library where the program is located.

Exit program (EXITPGM)

Specifies exit programs to be used when the interpreter is called. A maximum of 8 program and exit code pairs can be specified.

Note: If multiple system exit codes are specified, the last one specified is the one taken.

Single values

*NONE
There are no exit programs for this call.

Other values (up to 8 repetitions)

Element 1: Program

Qualifier 1: Program

name
Specify the name of the exit program.

Qualifier 2: Library

*LIBL
The library list is used to locate the specified program.
*CURLIB
The current library for the job is used to locate the specified program. If no library is specified as the current library for the job, QGPL is used.
name
Specify the name of the library where the specified program is located.

Element 2: Exit code

number
Specify one of the following exit code values.
Exit-code
Description
2
The associated program is called whenever an external function or subroutine has been called by the REXX program. The exit program is then responsible for locating and calling the requested routine.
3
The associated program is called whenever the interpreter is going to call a command. The exit program is responsible for locating and calling the command given the command string and the current environment name.
4
The associated program is called whenever a REXX instruction or function attempts an operation on the REXX external data queue.
5
The associated program is called when session input or output operations are attempted.
7
The associated program is called after running each clause of the REXX procedure to determine whether it should be stopped.
8
The associated program is called after running each clause of the REXX program to check if tracing should be turned on or off.
9
The associated program is called before interpretation of the first instruction of a REXX procedure (including REXX procedures called as external functions and subroutines).
10
The associated program is called after interpretation of the last instruction of a REXX procedure (including REXX procedures called as external functions and subroutines).

Examples

STRREXPRC   SRCMBR(ABC)

This command calls the REXX interpreter instructing it to run the source member named ABC in the first QREXSRC source file in the library list (*LIBL).

Error messages

*ESCAPE Messages

CPF7CFB
Error occurred while processing REXX exit programs.
CPF7CFD
Error occurred running REXX procedure &1.
CPF7CFF
REXX procedure &1 ended; return code &4.
CPF7CF2
REXX procedure &1 not found.
CPF7CF3
Not authorized to source file &2.
CPF7CF4
Cannot allocate REXX procedure &1.
CPF7CF6
Cannot allocate REXX source file &2.
CPF7CF7
REXX external data queue is damaged.