Initial Tests Conducted
A simple test program was written to test the generic attach approach. This program simply reads a few DB2 tables. Multiple copies of the program were created: one for TSO, one for Call Attach Facility (CAF), and one for RRS Attach Facility (RRSAF). Each program was written, linked, and tested using the traditional method of static calls to the DB2 attach module. For each program, the ATTACH pre-compiler option wasn’t specified, so the generic calls to DSNHLI were always used. For each load module created, the appropriate specific attach module was statically linked. Each program was tested before recoding for generic attach. After the initial testing, each program was altered for generic attach and tested. After numerous attempts, all tests were successful.
Specific Program and Binder (Link-Edit) Changes
Few changes are required to make the generic attach process work.
COBOL Program Changes
The following line was placed as the initial line of each COBOL program:
This allowed for dynamic calls from COBOL without having to change the COBOL compiler options. Optionally, the DYNAM COBOL compiler option can be specified.
COBOL Program Link-edit Changes
Consider an example of the link-edit control cards for one of the COBOL programs. The COBOL program name in this example is SRPOCCUB, and all link-edit control cards for this program are exactly the same for any normal COBOL program, but the attach module (DSNALI, DSNELI, DSNRLI) is intentionally left out. Figure 2 shows the link-edit control cards for the program.