Embedded SQL
- EXEC SQL. COBOL embeds SQL between EXEC SQL and END-EXEC: relational access inside the program.
- Host variables. Host variables carry values between COBOL and SQL: declared in both worlds, prefixed with colons.
- SQLCODE. Every statement sets SQLCODE: checked after each call, with +100 as the not-found that is not an error.
DB2 Concepts
- Cursors. A cursor walks a result set: DECLARE, OPEN, FETCH in a loop, CLOSE.
- Precompilation. Embedded SQL precompiles: statements bound into packages the database optimises ahead of time.
- NULL indicators. Nullable columns pair with indicator variables: absence handled explicitly, or values lie.
Transactional Data
- COMMIT and ROLLBACK. Units of work end with COMMIT or ROLLBACK: batch commits batched for restartability.
- Locking awareness. Long cursors hold locks: commit frequency balancing safety against concurrency.
- Integrity with files. Estates mix files and tables: consistency across both is the program’s burden, designed.
Before and after this level
- Before: Level 7: Batch Processing: Batch Jobs, JCL Interaction Concepts, Large-Scale Transaction Processing.
- Next: Level 9: Online Transactions: CICS Concepts, Transaction Programs, Enterprise Mainframe Workflows.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does COBOL Level 8: Databases cover?
Embedded SQL, DB2 Concepts, Transactional Data: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 7: Batch Processing, which covers Batch Jobs, JCL Interaction Concepts, Large-Scale Transaction Processing.