Transfer Control (TFRCTL)
Where allowed to run:
Threadsafe: Yes
- Batch program (*BPGM)
- Interactive program (*IPGM)
Parameters
Examples
Error messagesThe Transfer Control (TFRCTL) command calls the specified program, passes control to it, and removes the transferring program from the return stack. Because the transferring program is removed from the call stack, control does not return to it when the called program returns control. Instead, control is returned to the command following the last call to the transferring program.
Restrictions:
- This command is valid only within original program model (OPM) CL programs.
- You must have object operational (*OBJOPR) and execute (*EXECUTE) authorities to the program to be called, and *EXECUTE authority to the library where the program is located.
- The TFRCTL command is threadsafe, meaning that it can be used to call a program when the TFRCTL command is run in a job with multiple threads. No checking is done whether or not the program to be called is threadsafe.
Top
Parameters
Keyword Description Choices Notes PGM Program Qualified object name Required, Positional 1 Qualifier 1: Program Name Qualifier 2: Library Name, *LIBL, *CURLIB PARM Parameter CL variable names Values (up to 255 repetitions): CL variable name Optional, Positional 2
Top
Program (PGM)
Specifies the program that receives control from the program transferring control.
This is a required parameter.
Qualifier 1: Program
- name
- Specify the name of the program.
Qualifier 2: Library
- *LIBL
- All libraries in the library list for the current thread are searched until the first match is found.
- *CURLIB
- The current library for the thread is used to locate the program. If no library is specified as the current library for the thread, the QGPL library is used.
- name
- Specify the name of the library where the program is located.
Top
Parameter CL variable names (PARM)
Specifies one or more CL variables to be passed to the program that is to receive control. The variables passed can only be parameters that were passed to the program currently transferring control.
- CL-variable-name
- Specify the name of the CL variable to be passed. A maximum of 255 variables can be specified.
Top
Examples
TFRCTL PGM(PROGA) PARM(&PARM1)This command transfers control to the program PROGA and passes the parameter &PARM1 to it. The parameter &PARM1 must previously have been passed to the program issuing this command.
Top
Error messages
*ESCAPE Messages
- CPF0805
- Error found when program &1 in &2 started.
- CPF0809
- Transfer control (TFRCTL) to C program not allowed.
Top