Application programming on z/OS
|
Previous topic |
Next topic |
Contents |
Glossary |
Contact z/OS |
PDF
COBOL pre-processor and compile and link procedure Application programming on z/OS |
|
|
An example shows a three-step procedure for pre-processing a COBOL source program, compiling the output from the pre-processing step, and then linking it into a load library. The JCL in Figure 1 executes the DFHEITVL procedure, which is a three-step procedure for pre-processing a COBOL source program, compiling the output from the pre-processing step, and then linking it into a load library. The first step produces pre-processed source code in the SYSPUNCH temporary data sets, with any CICS® calls expanded into COBOL language statements. The second step takes this temporary data set as input and produces an object deck that is stored in the SYSLIN temporary data set, as shown in Figure 2. The third step takes the SYSLIN temporary data set as input, as well as any other modules that might need to be included, and creates a load module in the data set referenced by the SYSLMOD DD statement. In Figure 1, you can see that the JCL is a bit more complicated than in the simple compile job (Figure 1). Once we go from one step to multiple steps, we must tell the system which step we are referring to when we supply JCL overrides. Looking at the JCL in Figure 2, we see that the first step (each step is an EXEC statement, and the step name is the name on the same line as the EXEC statement) is named TRN, so we must qualify the SYSIN DD statement with TRN to ensure that it will be used in the TRN step. Similarly, the fourth step is called LKED, so we must qualify the SYSIN DD statement with LKED in order for it to apply to the LKED step. The end result of running the JCL in Figure 1 (assuming that there are no errors) should be to pre-process and compile our inline source program, link-edit the object deck, and then store the load module called PROG1 in the data set MY.LOADLIB. Figure 1. Basic JCL for
pre-processing, compiling, and linking a COBOL source program inline
//PPCOMLNK JOB
//PPCL EXEC DFHEITVL,PROGLIB='MY.LOADLIB'
//TRN.SYSIN DD *
IDENTIFICATION DIVISION (source program)
EXEC CICS ...
...
EXEC CICS ...
...
//LKED.SYSIN DD *
NAME PROG1(R)
/*
The statements shown in Figure 2 make up the DFHEITVL cataloged procedure used in Figure 1. As with the other compile and link procedures, the result of the preprocessor, compile, and link steps, which is the load module, is placed in the data set identified on the SYSLMOD DD statement. Figure 2. Procedure DFHEITVL
- COBOL preprocessor, compile, and link
//DFHEITVL PROC SUFFIX=1$, Suffix for translator module
//*
//* This procedure has been changed since CICS/ESA Version 3
//*
//* Parameter INDEX2 has been removed
//*
// INDEX='CICSTS12.CICS', Qualifier(s) for CICS libraries
// PROGLIB=&INDEX..SDFHLOAD, Name of output library
// DSCTLIB=&INDEX..SDFHCOB, Name of private macro/DSECT lib
// COMPHLQ='SYS1', Qualifier(s) for COBOL compiler
// OUTC=A, Class for print output
// REG=2M, Region size for all steps
// LNKPARM='LIST,XREF', Link edit parameters
// STUB='DFHEILIC', Link edit INCLUDE for DFHECI
// LIB='SDFHCOB', Library
// WORK=SYSDA Unit for work data sets
//* This procedure contains 4 steps
//* 1. Exec the COBOL translator
//* (using the supplied suffix 1$)
//* 2. Exec the vs COBOL II compiler
//* 3. Reblock &LIB(&STUB) for use by the linkedit step
//* 4. Linkedit the output into data set &PROGLIB
//*
Figure 3. Procedure DFHEITVL - COBOL preprocessor,
compile, and link (continued)
//* The following JCL should be used //* to execute this procedure //* //* //APPLPROG EXEC DFHEITVL //* //TRN.SYSIN DD * //* . //* . Application program //* . //* /* //* //LKED.SYSIN DD * //* NAME anyname(R) //* /* //* //* Where anyname is the name of your application program. //* (Refer to the system definition guide for full details, //* including what to do if your program contains calls to //* the common programming interface.) //* //TRN EXEC PGM=DFHECP&SUFFIX, // PARM='COBOL2', // REGION=® //STEPLIB DD DSN=&INDEX..SDFHLOAD,DISP=SHR //SYSPRINT DD SYSOUT=&OUTC //SYSPUNCH DD DSN=&&SYSCIN, // DISP=(,PASS),UNIT=&WORK, // DCB=BLKSIZE=400, // SPACE=(400,(400,100)) //* //COB EXEC PGM=IGYCRCTL,REGION=®, // PARM='NODYNAM,LIB,OBJECT,RENT,RES,APOST,MAP,XREF' //STEPLIB DD DSN=&COMPHLQ..COB2COMP,DISP=SHR //SYSLIB DD DSN=&DSCTLIB,DISP=SHR // DD DSN=&INDEX..SDFHCOB,DISP=SHR // DD DSN=&INDEX..SDFHMAC,DISP=SHR // DD DSN=&INDEX..SDFHSAMP,DISP=SHR //SYSPRINT DD SYSOUT=&OUTC //SYSIN DD DSN=&&SYSCIN,DISP=(OLD,DELETE) //SYSLIN DD DSN=&&LOADSET,DISP=(MOD,PASS), // UNIT=&WORK,SPACE=(80,(250,100)) //SYSUT1 DD UNIT=&WORK,SPACE=(460,(350,100)) //SYSUT2 DD UNIT=&WORK,SPACE=(460,(350,100)) //SYSUT3 DD UNIT=&WORK,SPACE=(460,(350,100)) //SYSUT4 DD UNIT=&WORK,SPACE=(460,(350,100)) //SYSUT5 DD UNIT=&WORK,SPACE=(460,(350,100)) //SYSUT6 DD UNIT=&WORK,SPACE=(460,(350,100)) //SYSUT7 DD UNIT=&WORK,SPACE=(460,(350,100)) //* Figure 4. Procedure DFHEITVL - COBOL preprocessor,
compile, and link (continued)
//COPYLINK EXEC PGM=IEBGENER,COND=(7,LT,COB) //SYSUT1 DD DSN=&INDEX..&LIB(&STUB),DISP=SHR //SYSUT2 DD DSN=&©LINK,DISP=(NEW,PASS), // DCB=(LRECL=80,BLKSIZE=400,RECFM=FB), // UNIT=&WORK,SPACE=(400,(20,20)) //SYSPRINT DD SYSOUT=&OUTC //SYSIN DD DUMMY //* //LKED EXEC PGM=IEWL,REGION=®, // PARM='&LNKPARM',COND=(5,LT,COB) //SYSLIB DD DSN=&INDEX..SDFHLOAD,DISP=SHR // DD DSN=&COMPHLQ..COB2CICS,DISP=SHR // DD DSN=&COMPHLQ..COB2LIB,DISP=SHR //SYSLMOD DD DSN=&PROGLIB,DISP=SHR //SYSUT1 DD UNIT=&WORK,DCB=BLKSIZE=1024, // SPACE=(1024,(200,20)) //SYSPRINT DD SYSOUT=&OUTC //SYSLIN DD DSN=&©LINK,DISP=(OLD,DELETE) // DD DSN=&&LOADSET,DISP=(OLD,DELETE) // DD DDNAME=SYSIN |
Copyright IBM Corporation 1990, 2010 |