CALL (Call a Program)

Free-Form Syntax (not allowed - use the CALLP operation code)
Code Factor 1 Factor 2 Result Field Indicators
CALL (E)   Program name Plist name _ ER LR

The CALL operation passes control to the program specified in factor 2.

Factor 2 must contain a character entry specifying the name of the program to be called.

In the result field, specify parameters in one of the following ways:
  • Enter the name of a PLIST
  • Leave the result field blank. This is valid if the called program does not access parameters or if the PARM statements directly follow the CALL operation.

Positions 71 and 72 must be blank.

To handle CALL exceptions (program status codes 202, 211, or 231), either the operation code extender 'E' or an error indicator ER can be specified, but not both. For more information on error handling, see Program Exception/Errors.

Any valid resulting indicator can be specified in positions 75 and 76 to be set on if the called program is an RPG program or cycle-main procedure that returns with the LR indicator on.
Note: The LR indicator is not allowed in a thread-safe environment.

For more information on call operations, see Call Operations.

Figure 1. CALL Operation
*...1....+....2....+....3....+....4....+....5....+....6....+....7....+....
CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq....
 *  The CALL operation calls PROGA and allows PROGA to access
 *  FieldA and FieldB, defined elsewhere. PROGA is run using the content
 *  of FieldA and FieldB.  When PROGA has completed, control
 *  returns to the statement following the last PARM statement.
 *
 *
C                   CALL      'PROGA'
C                   PARM                    FieldA
C                   PARM                    FieldB