In every ALLBASE/SQL COBOL program, you embed SQL commands
in the DATA DIVISION and the PROCEDURE DIVISION in order to:
- 1
Declare the SQL Communications Area (SQLCA)
- 2
Declare host variables
- 3
Start a DBE session by connecting to the DBEnvironment
- 4 , 5
Define transactions
- 6
Terminate the DBE session
- 7
Implicitly check the status of SQL command execution
- 8
Define or manipulate data in the DBEnvironment
- 9
Explicitly check the status of SQL command execution
- 10
Obtain error and warning messages from the ALLBASE/SQL message catalog
The program listing shown in Figure 3-1 “Sample Program COBEX2 ”
illustrates where in a program
you can embed SQL commands to accomplish the activities listed above.
This chapter is a high-level road map to the logical and
physical aspects of embedding SQL commands in a program. It
addresses the reasons for embedding commands to perform the
above activities. It also gives general rules for how and where
to embed SQL commands for these activities. First however,
it shows a program containing commands for the basic SQL
functions listed above.
Then it describes the general rules that apply when you embed any
SQL command, referring to the numbered statements in the program.