Command reference / CL

CALLPRC

Call Bound Procedure

Calls a bound procedure named on the command and passes control to it, optionally passing parameters. If the procedure returns a value, it can be stored in a CL variable through RTNVAL. Parameters can be passed by reference or by value. Up to 300 can be passed, although the called procedure's language may accept fewer; a CL procedure accepts at most 255.

Allowed environments: *BMOD, *IMOD. Use within a CL program. Positional parameters: 3.

Restrictions

Parameters

PRC Procedure

Names the procedure to call. Required. The name is case sensitive and may be up to 256 bytes. It must be in the same program as the caller or in a service program specified when the caller was created. A CL variable cannot be used.

Type
*CHAR
Required
Yes
Length
50
Case
Uppercase

PARM Parameters

Values passed to the called procedure, in order, up to 300. Types and lengths must match the called procedure's definitions.

Type
*ELEM
Required
No
List limit
300
Case
Uppercase
*OMIT
Omits the parameter by passing a null pointer. *BYVAL cannot be specified with it.
*BYREF
Passes the parameter by reference, so the called procedure can change a CL variable's value.
*BYVAL
Passes a copy of the parameter, so changes by the called procedure do not affect the CL variable. The called procedure must expect a by-value parameter.
*DFT
Default type and length. Character values use their own length; 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 a logical true or false value.
*INT
A signed binary integer parameter.
*UINT
An unsigned binary integer parameter.
*FLT
A binary floating-point parameter.
Elements in order

Parameter Parameter

Type
*CHAR
Required
No
Length
50
Case
Uppercase

Passed Passed

Type
*CHAR
Required
No
Default
*BYREF
Length
6
Case
Uppercase

Allowed values: *BYREF, *BYVAL

Type and length of parameter Type and length of parameter

Type
*ELEM
Required
No
Default
*DFT
Case
Uppercase

Suggested / special values: *DFT

Elements in order

Type Type

Type
*CHAR
Required
No
Length
5
Case
Uppercase

Allowed values: *DEC, *CHAR, *LGL, *INT, *UINT, *FLT

Length Length

Type
*INT4
Required
No
Case
Uppercase

Decimal positions Decimal positions

Type
*INT4
Required
No
Case
Uppercase

RTNVAL CL variable for returned value

Names the CL variable that receives the return value from the called procedure. A binary return value needs an integer CL variable or the %BIN built-in function.

Type
*VARNAME
Required
No
Default
*NONE
Length
10
Case
Uppercase

Suggested / special values: *NONE

*NONE
The called procedure does not return a value.

Examples

CALLPRC PRC(PAYROLL)

Calls procedure PAYROLL with no parameters. It returns no value.

CALLPRC PRC(SCAN_STRING) PARM((&STR1 *BYREF) (' ' *BYVAL)) RTNVAL(&POS)

Passes &STR1 by reference and a one-blank constant by value to SCAN_STRING, and stores its 2-byte binary return value in &POS.

IBM command documentation

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