Command reference / prog
CALL
Call Program
Calls the named program and passes control to it, optionally passing parameters. It can be used in batch and interactive jobs, in compiled and interpreted CL. The called program can return control with the RETURN command. Parameters are matched by position and must agree in count, order, type, and length with the called program's parameter list. Constants and expressions are passed as copies, while a CL variable passed to the program can be changed by it.
Allowed environments: *ALL.
Positional parameters: 2.
Restrictions
- The caller needs *OBJOPR and *EXECUTE authority to the program, and *EXECUTE authority to its library.
- CALL is threadsafe, so it can run in a multithreaded job. Whether the called program is threadsafe is not checked.
Parameters
PGM
Program
Names the program to call. Required. Qualified by library.
*LIBL- Search the library list for the current thread until the first match is found.
*CURLIB- Use the current library for the thread, or QGPL if none is set.
Qualified parts (object, then library; write LIBRARY/OBJECT)
Program
Program
Library
Library
Suggested / special values:
*LIBL, *CURLIB
PARM
Parameters
Values passed to the called program, in order, up to 255. Their types and lengths must match the called program's parameters or results are unpredictable.
*DFT- Default type and length. Character values get at least 32 bytes; numeric values are packed decimal with 15 digits and 5 decimal places; CL variables use their declared attributes.
*DEC- A packed decimal parameter.
*CHAR- A character string parameter.
*LGL- A logical parameter, passed as 1 byte holding '1' or '0'.
*INT- A signed binary integer parameter.
*UINT- An unsigned binary integer parameter.
*FLT- A binary floating-point parameter.
Examples
CALL PGM(PAYROLL)
Calls program PAYROLL with no parameters, using the library list to locate it.
CALL PGM(PAYROLL) PARM('1')
Passes the character constant '1' as a quoted string. The program must declare a field of up to 32 characters to receive it.
Generated from os/cl/catalog/CALL.json and os/cl/help/CALL.json.