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


COBOL compile link and go procedure

Application programming on z/OS

An example shows a three-step procedure for compiling a source program, linking it into a load library, and then executing the load module.

The JCL in Figure 1 executes the IGYWCLG procedure, which is a three-step procedure for compiling a source program, linking it into a load library, and then executing the load module. The first two steps are the same as those in the compile and link example (see related links). However, whereas in the other example we override the SYSLMOD DD statement in order to permanently save the load module, in Figure 1, we do not need to save it in order to execute it. That is why the override to the SYSLMOD DD statement in Figure 1 is enclosed in square brackets, to indicate that it is optional.

If it is coded, then the load module PROG1 will be permanently saved in MY.LOADLIB. If it is not coded, then the load module will be saved in a temporary data set and deleted after the GO step.

In Figure 1, you can see that the JCL is very similar to the JCL used in the simple compile job (see related links). Looking at the JCL in Figure 2, the only difference is that we have added the GO step. 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, store the load module (either temporarily or permanently), and then execute the load module.

Figure 1. Basic JCL for compiling, linking and executing a COBOL source program inline
//CLGO    JOB
//CLG     EXEC IGYWCLG
//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 IGYWCLG cataloged procedure used in Figure 1.

Figure 2. Procedure IGYWCLG - COBOL compile, link, and go
//IGYWCLG PROC LNGPRFX='IGY.V2R1M0',SYSLBLK=3200,           
//             LIBPRFX='CEE',GOPGM=GO                       
//*                  
//*  COMPILE, LINK EDIT AND RUN A COBOL PROGRAM             
//*                  
//*  PARAMETER  DEFAULT VALUE    USAGE                      
//*   LNGPRFX   IGY.V2R1M0       
//*   SYSLBLK   3200 
//*   LIBPRFX   CEE  
//*   GOPGM     GO   
//*                  
//*  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=&&GOSET(&GOPGM),SPACE=(TRK,(10,10,1)),     
//            UNIT=VIO,DISP=(MOD,PASS)                          
//SYSUT1   DD UNIT=VIO,SPACE=(TRK,(10,10))                      
//GO     EXEC PGM=*.LKED.SYSLMOD,COND=((8,LT,COBOL),(4,LT,LKED)),
//            REGION=2048K                                      
//STEPLIB  DD DSNAME=&LIBPRFX..SCEERUN,                         
//            DISP=SHR                                          
//SYSPRINT DD SYSOUT=*                                          
//CEEDUMP  DD SYSOUT=*                                          
//SYSUDUMP DD SYSOUT=* 




Copyright IBM Corporation 1990, 2010