SQL/MP Programming Manual for COBOL85
Introduction
HP NonStop SQL/MP Programming Manual for COBOL85—429326-004
1-4
SQL/MP System Procedures
 You code an SQL statement or directive by preceding it with EXEC SQL and then 
terminating it with END-EXEC. Example 1-1 shows static SQL statements embedded 
in a COBOL program: 
For more information, see Section 3, SQL/MP Statements and Directives, and 
Section 4, Data Retrieval and Modification. 
SQL/MP System Procedures
SQL/MP provides system procedures that perform various SQL operations and 
functions. For example, the SQLCA_DISPLAY2_ procedure returns error information 
from the SQLCA structure after an SQL statement executes. You call SQL system 
procedures from a COBOL program in the same manner you call other system 
procedures (for example, FILE_OPEN_, READ, WRITEREAD, and FILE_CLOSE_). 
This example shows a call to the SQLCA_DISPLAY2_ procedure using all default 
parameters: 
ENTER TAL "SQLCA_DISPLAY2_" USING SQLCA. 
For more information, see Section 5, SQL/MP System Procedures, and Section 11, 
Character Processing Rules (CPRL) Procedures.
Program Compilation and Execution 
The procedure to compile and execute a COBOL program that contains embedded 
SQL statements is similar to the steps you follow for a COBOL program that does not 
Example 1-1. Static SQL Statements in a COBOL Program
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 IN-PARTS-REC.
 02 IN-PARTNUM PIC 9(4) COMP.
 02 IN-PRICE PIC S9(8)V99 COMP.
 02 IN-PARTDESC PIC X(18).
EXEC SQL END DECLARE SECTION END-EXEC.
...
PROCEDURE DIVISION.
...
410-INSERT-DATA.
 MOVE 4120 TO IN-PARTNUM.
 MOVE 60000.00 TO IN-PRICE.
 MOVE "V8 DISK OPTION" TO IN-PARTDESC.
 EXEC SQL
 INSERT INTO SALES.PARTS
 (PARTNUM, PRICE, PARTDESC)
 VALUES (:IN-PARTNUM, :IN-PRICE, :IN-PARTDESC)
 END-EXEC.










