Previous Topic: CALL StatementNext Topic: Comment


CHECKPOINT Statement

The CHECKPOINT statement commits all database activity, establishing the most recent stable state for tables and files the application accesses. You can subsequently recover this state with a BACKOUT statement. In long running batch jobs, perform periodic CHECKPOINTs.

A CHECKPOINT applies to all CA Datacom/DB tables, DB2 tables, and all recoverable VSAM files in CICS. It does not apply to sequential files, non‑CICS VSAM files, panels, working data, or parameter data.

This statement has the following format:

CHECKPOINT

A TRANSMIT statement automatically causes a CHECKPOINT.

Executing a CHECKPOINT statement executes the following:

In a CICS environment the CHECKPOINT statement executes a CICS SYNCPOINT.

In a non‑CICS environment:

An SQL COMMIT statement is equivalent to a CHECKPOINT statement.

If a non‑ideal subprogram executes an SQL COMMIT (batch) or a CICS SYNCPOINT (online), execute a CA Ideal CHECKPOINT or SQL COMMIT on return to the CA Ideal program.

Do not code a checkpoint statement in a FOR construct because the database update for each iteration of a FOR statement takes place at the ENDFOR. Placing the CHECKPOINT in the FOR construct causes a checkpoint before the database is updated, a subsequent BACKOUT would include only that record.

The CHECKPOINT statement executes a TCLOSE operation that flushes certain VSAM buffers if there was any VSAM access before the CHECKPOINT.

The execution of a FOR EACH or FOR FIRST statement accessing a VSAM file can resume after a CHECKPOINT statement only if the access uses at least one unique key. For more information, see the FOR EACH/FIRST Statement (VSAM Access) topic in this chapter.

For CA Datacom SQL ANSI Mode and DB2: After the execution of a CHECKPOINT statement in the logical scope of a FOR EACH or FOR FIRST construct, the set of rows is lost. Therefore, continued iteration of that FOR construct cannot resume. For more information, see FOR EACH/FIRST Statement (SQL Access) in the FOR Statement (SQL Access) topic in this chapter.

For VSAM: In a CICS environment, only files defined to CICS as recoverable will be affected.

In a non-CICS environment, the CHECKPOINT statement causes the execution of a TCLOSE operation, which flushes certain VSAM buffers if there was any VSAM access prior to the CHECKPOINT.

The execution of a FOR EACH or FOR FIRST statement accessing a VSAM file can be resumed after a CHECKPOINT statement only if the access uses at least one unique key. For more information, see the FOR EACH/FIRST Statement (VSAM Access) topic in this chapter.

Example

The following example commits the database after a FOR NEW construct adds records using dataview z.

FOR EACH x
   statements : update of x
ENDFOR
FOR FIRST y
   statements : update of y
ENDFOR
FOR NEW z
   statements : add new z
ENDFOR
CHECKPOINT
FOR NEW w
   statements : add new w
ENDFOR