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

Parameters

PGM Program

Names the program to call. Required. Qualified by library.

Type
*QUAL
Required
Yes
Case
Uppercase
*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

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

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.

Type
*X
Required
No
Length
1
List limit
255
Case
Uppercase
*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.

IBM command documentation

Generated from os/cl/catalog/CALL.json and os/cl/help/CALL.json.