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:
numeric-n
is a literal or data item that is numeric.Numeric-data-n
is a numeric data item.
General Rules:
- When used with
CONTINUE
, the runtime saves the program state, and continues with execution. - 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. - 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 theGIVING [ numeric-data-1 ]
clause is specified,[ numeric-data-1 ]
is set to "1" when reloading and to "0" when execution resumes. - 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
orcobcrun -–reload -–checkpoint <checkpoint file>myprog