Generating once for z/OS® batch and CICS®

When you generate for z/OS® batch, you can ensure that the prepared load module will run in z/OS® batch or CICS®. The generation requires use of the DUALMODE symbolic parameter to ensure that the appropriate EGL modules are chosen at run time.

Here are other considerations:
  • When your code is executing under CICS®, the transaction must begin with an EGL CICS® main program that does not use DUALMODE or with a non-generated CICS® program. Thereafter your logic can call any of the following kinds of code: EGL called programs or libraries that use DUALMODE, EGL programs generated for z/OS® CICS®, or non-generated programs.
  • Usage of CICS® storage protection is allowed in the programs that use DUALMODE, but file I/O is not.
  • SQL I/O is supported, provided that when the generated program is prepared, you do an additional link edit for the CICS® load module. The link edit replaces the batch DB2® Interface module named DSNELI with the required CICS® DB2® interface module named DSNCLI.
If you are accessing DB2® and need to replace the DB2® interface module, you can create a linkedit part and reference it from the build descriptor that you use for z/OS® batch generation. The linkedit part might look as follows, with the text on each line starting in column 2:
 ENTRY %EZEALIAS%
 REPLACE DSNELI
 INCLUDE INPUT(%EZEALIAS%)
 INCLUDE SYSLIB(DSNCLI) 
 NAME %EZEALIAS%(R)

Adding and referencing that linkedit part results in execution of a relink step that is found in the FDABCL and FDAPCL build scripts for z/OS® batch. However, you must modify the build scripts as follows:

  • Go to the FDABCL build script, which prepares programs that do not access DB2®, and replace all of the existing relink (L2) step:
    //X  IF &HASLKG..EQ.YES 
    //L2 EXEC PGM=IEFBR14 
    //EZELKG    DD  CCUEXT=LKG,DISP=(NEW,DELETE), 
    //    UNIT=SYSDA,SPACE=(TRK,(10,10)),      
    //    DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200) 
    //X ENDIF                                     

    The change prevents any relink being done for the non-DB2 programs.

  • Go to the FDAPCL build script, which prepares programs that access DB2®. In that script, reference the target CICS® load library and INPUT file, as suggested here:
    //X  IF &HASLKG..EQ.YES 
    //L2        EXEC PGM=IEWL,REGION=&RGN, 
    //   PARM='RENT,REUS,LIST,XREF,MAP,AMODE(&AMODE),RMODE(&RMODE)' 
    //SELALMD  DD  DISP=SHR,DSN=&ELA..SELALMD
    //         DD  DISP=SHR,DSN=&ELA..SELAMOD2
    //SYSLIB   DD  DISP=SHR,DSN=&DFHLOAD
    //         DD  DISP=SHR,DSN=&DSNLOAD 
    //SYSLIN    DD  CCUEXT=LKG,DISP=(NEW,DELETE),
    //    UNIT=SYSDA,SPACE=(TRK,(10,10)),
    //    DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200) 
    //*   
    //* SYSLMOD CHANGED TO SPECIFY TARGET CICS® LOAD LIBRARY 
    //* 
    //SYSLMOD  DD  DISP=SHR,DSN=&CGHLQ..ZOSCICS.LOAD
    //SYSPRINT DD  CCUEXT=&CCUEXTL,DISP=(NEW,DELETE),
    //    UNIT=VIO,SPACE=(TRK,(30,10)), 
    //    DCB=(RECFM=FB,LRECL=121,BLKSIZE=1210)
    //SYSUT1   DD  SPACE=(1024,(&WSPC,&WSPC)),UNIT=VIO  
    //*PROVIDE ANY CUSTOM DD STATEMENTS HERE
    //* 
    //* INPUT REFERENCES OUTPUT FILE FROM PREVIOUS LINK STEP  
    //* 
    //INPUT    DD  DISP=SHR,DSN=&CGHLQ..&SYSTEM..LOAD
    //X    ENDIF 
    //