Application programming on z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


COBOL compile and link procedure

Application programming on z/OS

An example shows a two-step procedure for compiling a source program and linking it into a load library.

The JCL in Figure 1 executes the IGYWCL procedure, which is a two-step procedure for compiling a source program and linking it into a load library. The first step produces an object deck that is stored in the SYSLIN temporary data set, as shown in Figure 2. The second 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.

The end result of running the JCL in Figure 1 (assuming that there are no errors) should be to 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 compiling and linking a COBOL source program inline
//COMLNK   JOB
//CL       EXEC IGYWCL
//COBOL.SYSIN    DD *
   IDENTIFICATION DIVISION (source program)
.
.
.
/*
//LKED.SYSLMOD DD DSN=MY.LOADLIB(PROG1),DISP=OLD

The statements shown in Figure 2 make up the IGYWCL cataloged procedure used in Figure 1. As mentioned previously, the result of the compile and link steps, which is the load module, is placed in the data set identified on the SYSLMOD DD statement.

Figure 2. Procedure IGYWCL - COBOL compile and link
//IGYWCL PROC LNGPRFX='IGY.V2R1M0',SYSLBLK=3200,                     
//            LIBPRFX='CEE',                                         
//            PGMLIB='&&GOSET',GOPGM=GO                              
//*                  
//*  COMPILE AND LINK EDIT A COBOL PROGRAM                            
//*                  
//*  PARAMETER  DEFAULT VALUE                         
//*   LNGPRFX   IGY.V2R1M0     
//*   SYSLBLK   3200           
//*   LIBPRFX   CEE            
//*   PGMLIB    &&GOSET          DATA SET NAME FOR LOAD MODULE     
//*   GOPGM     GO               MEMBER NAME FOR LOAD MODULE       
//*                                                               
//*  CALLER MUST SUPPLY //COBOL.SYSIN DD ...                       
//*                  
//COBOL  EXEC PGM=IGYCRCTL,REGION=2048K                            
//STEPLIB  DD DSNAME=&LNGPRFX..SIGYCOMP,                          
//            DISP=SHR                                            
//SYSPRINT DD SYSOUT=*                                            
//SYSLIN   DD DSNAME=&&LOADSET,UNIT=VIO,                          
//            DISP=(MOD,PASS),SPACE=(TRK,(3,3)),                  
//            DCB=(BLKSIZE=&SYSLBLK)                              
//SYSUT1   DD UNIT=VIO,SPACE=(CYL,(1,1))                          
//SYSUT2   DD UNIT=VIO,SPACE=(CYL,(1,1))                          
//SYSUT3   DD UNIT=VIO,SPACE=(CYL,(1,1))                          
//SYSUT4   DD UNIT=VIO,SPACE=(CYL,(1,1))                          
//SYSUT5   DD UNIT=VIO,SPACE=(CYL,(1,1))                          
//SYSUT6   DD UNIT=VIO,SPACE=(CYL,(1,1))                          
//SYSUT7   DD UNIT=VIO,SPACE=(CYL,(1,1))                          
//LKED   EXEC PGM=HEWL,COND=(8,LT,COBOL),REGION=1024K              
//SYSLIB   DD DSNAME=&LIBPRFX..SCEELKED,                          
//            DISP=SHR                                            
//SYSPRINT DD SYSOUT=*                                            
//SYSLIN   DD DSNAME=&&LOADSET,DISP=(OLD,DELETE)                  
//         DD DDNAME=SYSIN                       
//SYSLMOD  DD DSNAME=&PGMLIB(&GOPGM),            
//            SPACE=(TRK,(10,10,1)),             
//            UNIT=VIO,DISP=(MOD,PASS)           
//SYSUT1   DD UNIT=VIO,SPACE=(TRK,(10,10))       




Copyright IBM Corporation 1990, 2010