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-nis a literal or data item that is numeric.Numeric-data-nis 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
CHECKPOINTline. 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
CHECKPOINTverb 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