SQL/MX 2.x Reference Manual (H06.04+)

Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
3-68
COBOL Examples of INVOKE
COBOL Examples of INVOKE
Suppose that the EMPLOYEE table consists of the EMPNUM, FIRST_NAME,
LAST_NAME, and DEPTNUM columns. The FIRST_NAME column allows null,
and the EMPNUM column is the primary key. This example shows an INVOKE
statement with the NULL STRUCTURE clause and part of the structure that is
generated:
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
EXEC SQL INVOKE employee AS EMPTBL-REC NULL STRUCTURE
END-EXEC.
EXEC SQL END DECLARE SECTION END-EXEC.
NonStop SQL/MX generates this record:
* Record Definition for table PERSNL.EMPLOYEE
01 EMPTBL-REC.
02 EMPNUM PIC 9(4) comp.
02 FIRST-NAME.
03 INDICATOR PIC S9(4) comp.
03 VALU PIC X(15).
02 LAST-NAME PIC X(20).
02 DEPTNUM PIC 9(4) comp.
This example shows the generated structure template that the previous INVOKE
directive would have generated if the EMPLOYEE table did not contain a user-
defined primary key, such as the EMPNUM column. Note the presence of
SYSKEY:
* Record Definition for table PERSNL.EMPLOYEE
01 EMPTBL-REC.
02 SYSKEY PIC S9(18) comp.
02 EMPNUM PIC 9(4) comp.
02 FIRST-NAME.
03 INDICATOR PIC S9(4) comp.
03 VALU PIC X(15).
02 LAST-NAME PIC X(20).
02 DEPTNUM PIC 9(4) comp.