ARIS6CD is a C language sample program for VSE systems that is shipped with the DB2 Server for VSE product. ARIS6CC is a C language sample program for VM systems that is shipped with the DB2 Server for VSE 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.
The program satisfies the requirements of the application prolog and epilog. Near the beginning of the program all the host variables are declared, and error handling is defined. Near the logical end of the program, the database changes are rolled back, to assure that the database remains consistent for each use of the sample program. (For your own applications, of course, you will enter a COMMIT statement.)
To determine the types of C host variables to declare, refer to Figure 115 which gives the C representation for each of the DB2 Server for VSE & VM data types. Note the following:
There are two other types of nulls to be aware of. Quite separate from the NUL character described above, C refers to a pointer value as NULL, in a similar way to PL/I. A C NULL pointer has a value of 0, and C allows the word NULL in pointer assignments and expressions. This use of NULL is distinct from the DB2 Server for VSE & VM NULL, which means an undefined column or expression value. The word NULL can be used in a C program to mean either. You can always determine which is meant by the context.
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. (These tables are described in the DB2 Server for VSE & VM SQL Reference manual.)