ARIS6CBD is a COBOL language sample program for VSE systems that is shipped with the DB2 Server for VSE product. ARIS6CBC is a COBOL sample language program for VM systems that is shipped with the DB2 Server for VM product. It resides on the production disk for the base product. You may find it useful to print this sample program before going through this appendix as the hard copy will provide an illustration for many of the topics discussed here.
Here is a summary of the program by COBOL Divisions:
You do not have to do anything different in either of these divisions for DB2 Server for VSE & VM applications.
In the Data Division of any COBOL application, you must declare all host variables and the SQLCA structure.
The only SQL statements allowed in the Data Division are those shown in the sample program and the INCLUDE statement; all others must be placed in the Procedure Division.
The COBOL PICTURE clauses for the host variables are determined by referring to Figure 120 which gives the COBOL representation for each of the DB2 Server for VSE & VM data types. When you are coding your own applications, you will need to obtain the data types of the columns that your host variables interact with. This can be done by querying the catalog tables, which are described in the DB2 Server for VSE & VM SQL Reference manual.
The program must explicitly connect to the application server. WHENEVER statements should be coded to provide for error handling. Near the logical end of the program, the database changes are rolled back, to ensure that the database remains consistent for each use of the sample program. (For your own applications, of course, you will enter a COMMIT statement.)