#BEGINBUCKET ActionBCModuleCheck
#/ Template to avoid back-leveling modules for Actions B/C
#/ This template is processed only for either [INSTALL-DIRECT] or
#/ [INSTALL-TO-STAGE]. The CPYCK[CODE] step compares the list of modules
#/ in production and the ones in .ML, and builds an exclusion list to
#/ be used as input to the IEBCOPY step to prevent older modules from
#/ replacing newer ones.
#/ For an action B, the LLLDCK module resides in the LD mvs2bdscode, so
#/ allocation to ML is only in that STEPLIB since it gets copied to
#/ <HLQ>.LIBRARY prior to the other executable libraries being utilized.
#/ The other piece of this is BucketDefDsnallocML.txt, which generates
#/ the JCL to create the .ML libraries.
#/ ---------------------------------------------------------------------
//*
#/ JCL for checking link dates on modules. This is present only for
#/ Actions B and C.
#/ -------------------------------------------------
#BEGINDEFS
#/ -------------------------------------------------
#SYMBOLCALLS SYSOUT;CUSTPRODQUAL;STAGEQUAL;ORDERENCODING;
#/ -------------------------------------------------
#BEGININSTANCEQUALIFIERS
#/ -------------------------------------------------
#TABLEFIX {MVS2BDSCODE} #/ Fix ds table row from the instance
#IFEQ [RECFM] U #THEN QUALIFIES #/ only executable libraries
#THEN NEXT
#QUALIFIES
#SET [MVSDSCODE] {MVS2BDSCODE}
#INSTANCEUNIQUEKEY [[MVSDSCODE]:LOQUAL] #NOTUNIQUE NEXT
#CREATEINSTANCEFROMENTRY
#ENDQUALIFIERS
#NEXT
#/ -------------------------------------------------
#BEGINPREFIX
#/ -------------------------------------------------
#/ -------------------------------------------------
#BEGININSTANCE
#/ -------------------------------------------------
#/ Need to concatenate the staged library so that any updates
#/ to the LLLDCK module are picked up.
//CPYCK[MVSDSCODE] EXEC PGM=LLLDCK,PARM='VERBOSE',COND=(4,LT)
//STEPLIB  DD DISP=SHR,
#IFEQ [HOTFIX] TRUE #THEN SKIP
#IFNOT [INSTALL-DIRECT] #THEN NEXT
#IFNOTEQ {MVS2BDSCODE} LD #THEN CKLE
//   DSN=[CUSTPRODQUAL].ML.[LD:LOQUAL]        #/ 31-bit library
#THEN DISPSHR
#CKLE
#IFNOTEQ {MVS2BDSCODE} ZE #THEN SKIP          #/ 64-bit library
//   DSN=[CUSTPRODQUAL].ML.[ZE:LOQUAL]
#DISPSHR
//   DD DISP=SHR,
#THEN SKIP
#NEXT
#IFNOT [INSTALL-TO-STAGE] #THEN SKIP
#IFNOTEQ {MVS2BDSCODE} LD #THEN CKZE
//   DSN=[CUSTPRODQUAL].ML.[LD:LOQUAL]        #/ 31-bit library
#THEN DISP
#CKZE
#IFNOTEQ {MVS2BDSCODE} ZE #THEN USESL         #/ 64-bit library
//   DSN=[CUSTPRODQUAL].ML.[ZE:LOQUAL]
#THEN DISP
#USESL
//   DSN=[CUSTPRODQUAL].SL.[LD:LOQUAL]        #/ staged library
#DISP
//   DD DISP=SHR,
#SKIP
//   DSN=[CUSTPRODQUAL].[LD:LOQUAL]
//SYSPRINT DD SYSOUT=[SYSOUT]
//SYSUT1   DD DISP=SHR,
//  DSN=[CUSTPRODQUAL].ML.[LOQUAL]
//SYSUT2   DD DISP=SHR,
//  DSN=[CUSTPRODQUAL].[[MVSDSCODE]:LOQUAL]
//SYSUT3   DD DSN=&&EXCLUDES,
//         UNIT=[TMPUNI],SPACE=(TRK,(1,1)),DISP=(NEW,PASS)
//*
#/ Att this point the exclusion list has been created.
#/ Move the new modules from .ML to the .SL libraries for
#/ Action C or to the production libraries for Action B.
//SELCT[MVSDSCODE]  EXEC PGM=IEBCOPY,COND=(4,LT)
//SYSPRINT DD SYSOUT=[SYSOUT]
//SYSUT3   DD UNIT=[TMPUNI],SPACE=(TRK,(1,1))
//SYSUT4   DD UNIT=[TMPUNI],SPACE=(TRK,(1,1))
//DDLD     DD DISP=OLD,
#IFNOT [INSTALL-TO-STAGE] #THEN NEXT                #/Action B not staged
//    DSN=[CUSTPRODQUAL][STAGEQUAL].[LOQUAL]
#THEN ACTC
#NEXT
//    DSN=[CUSTPRODQUAL].[LOQUAL]
#ACTC
//DDTD     DD DISP=OLD,
//    DSN=[CUSTPRODQUAL].ML.[LOQUAL]
//DDTM     DD DSN=&&LIBRT,UNIT=[TMPUNI],
#IFNOTEQ [HOTFIX] TRUE #THEN NOTHF                  #/ A hotfix needs less LIBRARY space
#IFNOTEQ {MVS2BDSCODE} LD #THEN NOTHF               #/ Check payload for LIBRARY content
//     SPACE=(6000,(13000,13000,50),,,ROUND),       #/ smaller allocation for a hotfix
#THEN SKIPSPC
#NOTHF
//    SPACE=[SPACEPARMS],
#SKIPSPC
#IFNOTEQ [DATASETTYPE] PDSE #THEN PDS
//    DSNTYPE=LIBRARY,
#THEN SKIP
#PDS
//    DSNTYPE=[DATASETTYPE],
#SKIP
//    DCB=(DSORG=[DSORG],RECFM=[RECFM],BLKSIZE=[BLKSIZE])
#/ CP1 copies the maintenance library to a temporary with
#/ the EXCLUDE statements from the concatenated &&EXCLUDES.
#/ CP2 copies the temporary to the production library (for Action B)
#/ or the staged library (for Action C).
#/ CP3 compresses the target library.
//SYSIN    DD DATA,DLM='!S'
CP1 COPY INDD=((DDTD,R)),OUTDD=DDTM
!S
//         DD DSN=&&EXCLUDES,DISP=(OLD,DELETE)
//         DD DATA,DLM='!S'
CP2 COPY INDD=((DDTM,R)),OUTDD=DDLD
CP3 COPY INDD=((DDLD,R)),OUTDD=DDLD
!S
//*
#/ ------------------------------------------------------------
//* Delete the .ML library as it is not needed for production
#/ ------------------------------------------------------------
//REM[MVSDSCODE] EXEC PGM=IEFBR14,COND=(4,LT)
//DDDEL[MVSDSCODE] DD DSN=[CUSTPRODQUAL].ML.[LOQUAL],
// DISP=(MOD,DELETE,KEEP),UNIT=[TMPUNI],SPACE=(TRK,(1,,1))
//*
#/ -------------------------------------------------
#BEGINSUFFIX
#/ -------------------------------------------------
#ENDBUCKET
