CHAIN Statement

The CHAIN statement provides a method for starting another run unit.

General Format

CHAIN program-name [ USING {parameter} ... ]

   [ ON {EXCEPTION} statement ]
        {OVERFLOW }

   [ END-CHAIN ]

Syntax Rules

  1. program-name is a nonnumeric literal or an alphanumeric data item.
  2. parameter is any non-level 88 data item or a nonnumeric literal. No more than 50 parameters may be specified.
  3. statement is an imperative statement.
  4. If a CHAIN statement appears in a consecutive sequence of imperative statements within a sentence, it must be the last statement in that sequence, unless the EXCEPTION phrase is specified.

General Rules

  1. The CHAIN statement causes the current run unit to terminate and initiates a new run unit. Executing a CHAIN statement has the following effects:
    1. The current run unit is halted as if a STOP RUN statement were executed.
    2. The run unit specified by program-name is initiated. program-name is resolved into an executable program name using the same rules specified for the CALL statement.
  2. If the EXCEPTION phrase is used, then statement executes if the CHAIN statement is unable to load program-name. This is usually caused by program-name being either absent or not readable by the runtime system. Certain types of errors cannot be caught by the ON EXCEPTION phrase because of the nature of the CHAIN statement. If the EXCEPTION phrase is not present when an error occurs, the runtime system prints a message and halts.
  3. If the USING phrase is specified, each parameter is transferred to the new run unit. Each parameter is mapped to the corresponding CHAINING argument in the new run unit. See Procedure Division Format for a description of the CHAINING phrase.