SPICE - Span Integrated Checkpoint/Restart Environment
1.Simple Variable
01 SPICE-SAM PIC X(18) VALUE '!SPICE!_SAM'.
01 INDDA-DD PIC X(18) VALUE '!DDNAME!=INDDA'.
01 VAR-A PIC X(128).
EXEC SQL
INCLUDE SPIRINCC
END-EXEC.
EXEC SQL
DECLARE INDDA_CURSOR CURSOR FOR
SELECT CHAR_1
FROM SPICE_SAM
WHERE CATEGORY=:SPICE-SAM AND FILE=:INDDA-DD
END-EXEC.
EXEC SQL
OPEN INDDA_CURSOR
END-EXEC.
01 VAR-A PIC X(128).
EXEC SQL
FETCH INDDA_CURSOR
INTO :VAR-A
END-EXEC.
----------------------------------------------------------------------------------------------------------------------------------------
2. Structure
01 SPICE-SAM PIC X(18) VALUE '!SPICE!_SAM'.
01 INDDB-DD PIC X(18) VALUE '!DDNAME!=INDDB'.
01 INDDB-RECLEN PIC X(18) VALUE '!RECLEN!=124'.
01 STRUCT-B.
02 NAME PIC X(32).
02 AGE PIC S9(4) COMP.
02 ADDRESS.
49 ADDRESSL PIC S9(4) COMP.
49 ADDRESSC PIC X(64).
02 PHONE-NO PIC X(24).
EXEC SQL
INCLUDE SPIRINCC
END-EXEC.
EXEC SQL
DECLARE INDDB_CURSOR CURSOR FOR
SELECT CHAR_1,INT_1,VARCHAR_1,CHAR_2
FROM SPICE_SAM
WHERE CATEGORY=:SPICE-SAM AND FILE=:INDDB-DD
AND RECLEN = :INDDB-RECLEN
END-EXEC.
EXEC SQL
OPEN INDDB_CURSOR
END-EXEC.
01 STRUCT-B.
02 NAME PIC X(32).
02 AGE PIC S9(4) COMP.
02 ADDRESS.
49 ADDRESSL PIC S9(4) COMP.
49 ADDRESSC PIC X(64).
02 PHONE-NO PIC X(24).
EXEC SQL
FETCH INDDB_CURSOR
INTO :STRUCT-B
END-EXEC.
----------------------------------------------------------------------------------------------------------------------------------------
3. VARCHAR Structure
01 SPICE-SAM PIC X(18) VALUE '!SPICE!_SAM'.
01 INDDC-DD PIC X(18) VALUE '!DDNAME!=INDDC'.
01 STRUCT-C.
49 L PIC S9(4) COMP.
49 D PIC X(64).
EXEC SQL
INCLUDE SPIRINCC
END-EXEC.
EXEC SQL
DECLARE INDDC_CURSOR CURSOR FOR
SELECT VARCHAR_1
FROM SPICE_SAM
WHERE CATEGORY=:SPICE-SAM AND FILE=:INDDC-DD
END-EXEC.
EXEC SQL
OPEN INDDC_CURSOR
END-EXEC.
01 STRUCT-C.
49 L PIC S9(4) COMP.
49 D PIC X(64).
EXEC SQL
FETCH INDDC_CURSOR
INTO :STRUCT-C
END-EXEC.
Note:
The host structure or set of host variables must collate into a single continuous area of storage. Host structures in COBOL programs should not contain any variables named FILLER, as the DB2 precompiler will omit them from the list of data items passed to SPICE
SQL.
If this statement is the first reference to the file since a restart, SPICE will restart the file. It will re-position it to its position at the time of the last successful commit point.
If all the records in the file have been read, an SQLCODE of +100 is returned.
If SPICE is unable to read a record an SQLCODE of -681 is returned.