action.skip

CHECKPOINT Statement

The CHECKPOINT Statement saves the current state of a program (field values, call stack, perform stack) into a file named <checkpoint prefix><program-id>.ctx.

Format 1

       CHECKPOINT [checkpoint prefix] CONTINUE 
       [ { GIVING } numeric-data-1 ]

Format 2

       CHECKPOINT [checkpoint prefix] EXIT 
                  [ { RETURNING } numeric-1 ] 
                    { WITH      }

Syntax:

  1. numeric-n is a literal or data item that is numeric.
  2. Numeric-data-n is a numeric data item.

General Rules:

  1. When used with CONTINUE, the runtime saves the program state, and continues with execution.
  2. When used with EXIT RETURNING [ numeric-data-1 ], the runtime saves the program state, exits the program, and returns [ numeric-data-1 ] to the calling program.
  3. When running a program with a checkpoint file, the runtime reloads the program state from the checkpoint file, and continues execution at the statement following the CHECKPOINT line. If the GIVING [ numeric-data-1 ] clause is specified, [ numeric-data-1 ] is set to "1" when reloading and to "0" when execution resumes.
  4. Use of the CHECKPOINT verb requires that all programs in the call stack be compiled with Reloading a program with a checkpoint file is done by using the reload argument as follows:
    cobcrun --reload myprog
    or
    cobcrun -–reload -–checkpoint <checkpoint file>myprog