gtpa3m0o | Application Requester User's Guide |
Figure 15 shows the basic flow of transforming an application from source code to object code on TPF and into a bind file on DB2 through the DB2 bind process. The bind process converts output from a DB2 precompiler (DBRM) to the usable control structure known as a bind file. During this process, complete error checking and access strategy is performed for each SQL command. In ISO-C programs, you can perform binding directly on DB2 offline (static binding) before you run the application. Alternatively, TPF can perform a bind at run time (run-time binding).
Figure 15. Overview of TPF Application Preparation
TPF application programs must be precompiled using the DB2 precompiler on the MVS system. The DB2 program preparation procedure is described in the IBM Database 2 Application Programming and SQL Guide.
The following explains each of the steps in Figure 15.
In place of the SQL commands, the DB2 precompiler places host language system calls into the application programs.
The following parameters are important to the DB2 precompiler:
See Using the TPF DB2 Postprocessor (TPF DB2PP) for more information about the TPF DB2PP HOST parameter.
Supporting multiple versions can also be accomplished by changing the member name of the DBRM data set where the DB2 precomplier places the output DBRM. This member name is what DB2 uses to correlate different DB2 packages. By changing the DBRM member for different versions of the same program, multiple copies of the same program can have active DB2 packages. See step 5 for more information on DB2 packages.
See the IBM DATABASE 2 Command and Utility Reference for more information regarding the DB2 precompiler options.
The output from the bind process is called a package. A package is an object containing a set of SQL statements that have been bound and are available for processing.
The DB2 package is called at program execution time to execute the SQL commands extracted from the program during DB2 precompilation. (See step 2.) The package is in a format understood only by the DB2. The DBRM could be transported to another MVS system, using MVS system utilities for example, and bound on the second system if the TPFAR application is to also connect and to work on this second system.
When binding the DBRM, the following options are required:
Each of these pieces is separated by an underscore (_). For example, the parameter could be:
TPFNET_BSS_HPN
When running the bind process in a batch mode, the parameter is specified as PACKAGE. When running the bind process through the DB2 interactive panels, the parameter is specified at the COLLECTION-ID entry field. Both PACKAGE and COLLECTION-ID refer to the same value.
See the IBM DATABASE 2 Command and Utility Reference for more information about the bind options.
When writing a C application using SQL, the TPF DB2 postprocessor (TPF DB2PP) offline module needs to be run against the DB2 precompiler output. The TPF DB2PP program alters and removes some variables that the DB2 precompiler sets up for the TPF C compiler with the TPF option to run successfully.
If the modified C program is not run through TPF DB2PP before C compiling,
the program does not compile. Table 2 shows the strings that are altered by the TPF DB2PP program
for C programs.
Table 2. Strings Altered by TPF DB2PP for C Programs
Original String | Altered String |
---|---|
#pragma linkage (DSNHLI,OS); | (This field is removed by the TPF DB2PP program. The C header file tpfarapi.h will resolve the DSNHLI call.) |
char SQLTEMP??( 19 ??); | static char SQLTEMP??(19??); |
struct sqlca sqlca; | static struct sqlca sqlca; |
struct SQLVTAG SQLVERS | static struct SQLVTAG SQLVERS |
char DSNPNM??( 57 ??); | static char DSNPNM??( 57 ??); |
TPF DB2PP has different required PARM parameters, depending on whether an ISO-C or a TARGET(TPF) program is to be processed.
If an ISO-C program is being postprocessed, there are two required parameters. Any additional parameters result in an error.
PARM='HOST(ISOC) PKGISOL(CS)'
If a TARGET(TPF) program is being postprocessed, there is one required parameter. Any additional parameters result in an error.
PARM='HOST(C)'
Figure 16 shows sample JCL that you can use to process the output from the DB2 precompiler. The HOST(ISOC) and package isolation level PKISOL are also shown.
Figure 16. Sample JCL to Run TPF DB2PP
//MODIFY EXEC PGM=DB2PP,REGION=4096K,PARM='HOST(ISOC) PKGISOL(CS)' //STEPLIB DD DSN=AR20000.DEVP.TEST.LK,DISP=SHR // DD DSN=ACP.LINK.INTG40.BSS,DISP=SHR // DD DSN=ACP.LINK.RLSE31.BSS,DISP=SHR // DD DSN=SYS1.CEE.SCEERUN,DISP=SHR //SYSPRINT DD SYSOUT=* //INFILE DD DSN=&&DSNHOUT,DISP=(OLD,DELETE) //DBRMLIB DD DSN=AR20000.DEVP.TEST.DBRM(QXMARF),DISP=(OLD,PASS) //OUTFILE DD DSN=&&TEMP,DISP=(NEW,PASS),UNIT=SYSDA, // DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=80) //* //COPY EXEC PGM=IEBGENER,REGION=58K //SYSPRINT DD SYSOUT=A //SYSIN DD DUMMY //SYSUT2 DD DSN=TPFAR.TEST.SRCE(QXP1JV),DISP=OLD //SYSUT1 DD DSN=&&TEMP,DISP=(OLD,PASS) //*