Coding SQL statements in COBOL application programs
When you code SQL statements in COBOL application programs, you should follow certain guidelines.
Defining the SQL communications area in COBOL
COBOL programs that contain SQL statements can include an SQL communications area (SQLIMSCA) to check whether an SQL statement executed successfully.
Defining SQL descriptor areas in COBOL
If your program includes certain SQL statements such as DESCRIBE, you must define at least one SQL descriptor area (SQLIMSDA). Depending on the context in which it is used, the SQLIMSDA stores information about prepared SQL statements or host variables. This information can then be read by either the application program or IMS.
Declaring host variables and indicator variables in COBOL
You can use host variables and host structures in SQL statements in your program to pass data between IMS and your application.
Equivalent SQL and COBOL data types
When you declare host variables in your COBOL programs, the precompiler uses equivalent SQL data types. When you retrieve data of a particular SQL data type into a host variable, you need to ensure that the host variable is of an equivalent data type.
SQL statements in COBOL programs
You can code SQL statements in certain COBOL program sections.
SQL aggregate functions supported for COBOL
SQL aggregate functions are supported for COBOL and .NET applications (by using
IMS Enterprise Suite
IMS Data Provider for Microsoft .NET
).
Parent topic:
Writing application programs for SQL