DB2 Host VariablesDB2 Program Executing Process DB2 SQLCA
DB2 is an external system and can’t able to update from the program.
COBOL program can’t able to retrieve the data directly by the SQL and can’t able to use it directly.
There is a requirement to use intermediate fields to capture the data and then only it is ready to use in the program.
There is one more limitation for the working storage fields are, the declaration should match with the corresponding table column COBOL declaration.
These variables are called as HOST VARIABLES.
Equivalent data types in COBOL & DB2
Database column equalent variable can be created by DCLGEN.
DCLGEN is the tool which is used to generate the COBOL copybook for the specific table.
The columns names of the table will be remain same but the underscores are replaced by Hyphens.
That copybook can be used in the program by using INCLUDE command like below.
EXEC SQL INCLUDE table-copybook END-EXEC.
If INCLUDE is used to add the copybook to the program, the copybook will be expanded during the pre- compilation process.
So INCLUDE needs to be used for the table copybooks too hence those also required to be expanded during the pre-compilation process.
DB2 Program Executing Process DB2 SQLCA