Go BackSQL/DS: The Programming Environment

Synopsis
SQL/DS: The Programming Environment introduces the programming considerations related to embedding SQL statements in a COBOL program.

Audience
This course is designed for COBOL programmers who want to use SQL in their programs to access data in SQL/DS tables.

Time
2 - 4 hours

Product Code: SDS102
After completing this course, the student should be able to:
 
Describe when and why SQL is embedded in a COBOL program
Identify the tools available and the tasks to perform in your environment
Explain how SQL reads data into and writes from Working Storage
Describe the communication that occurs between COBOL and SQL
Overview
Shows how easy it is to embed SQL in a COBOL program and introduces all the programming considerations that are treated in depth in later sections.
 
Embedding SQL in a Program
Advantages to embedding SQL in a COBOL program.  Some things SQL can't do.  Key points about embedding SQL in a COBOL program.
SQL in the Programming Environment
SQL in batch and on-line COBOL programs.  SQL/DS and non-SQL/DS data.  QMF and ISQL capabilities.  The preprocess step of program preparation.
Course Tables
Data found in the tables used in the course.


Embedding SQL in a Program
Shows how SQL reads data into and writes from Working Storage.  Covers in detail rules for communicating between COBOL and SQL, together with error checking.
 
Overview of Embedded SQL
SQL and COBOL communication through host variables.  Connecting your application to SQL/DS.  Error and result codes available in the SQLCA.  The SQL WHENEVER statement to check error and result codes.  Testing SQLCA fields via code in your program.
The Procedure Division
Opening and closing files versus SQL/DS tables.  The SQL CONNECT statement.  The SQL SELECT INTO statement.  Host variables in the SELECT statement and WHERE clause.  Use and coding of host variables.  Referential constraint considerations.
The Data Division
Declaring host variables in Working Storage or the Linkage Section via the SQL DECLARE statement.  Host structures and the SQLCA in Working Storage.  Declaring the SQLCA via the SQL INCLUDE statement.
Error Handling
The SQLCODE field to determine statement execution.  Additional fields in the SQLCA with error-related information.  Coding and use of the WHENEVER statement for error checking.  Procedural checking of the SQLCA fields.

Go Back