Mainframe Utility: PCKGCHCK

Return to Mainframe Utilities Page

Module


/**********************************************************************
/* UTILITY: PCKGCHCK                                                  *
/* AUTHOR: PHILIPP KNETEMANN                                          *
/* FUNCTION: THIS CLIST CREATES JCL TO COMPARE THE COMPONENTS OF      *
/*           A PACKAGE AGAINST THE LISTA? MEMBERS.                    *
/**********************************************************************
PROC 1 PACKAGE_ID +
       ENVIRON(QUAL) +
       STAGE(Q) +
       SYSTEM(STR) +
       SUBSYS(UNIPAC) +
       CLASS('5,TIME=(5,00)') +
       BATCH +
       USERID() +
       UTILITY(PCKGCHCK) +
       EDIT +
       HELP

/**********************************************************************
/* MISCELLANEOUS INITIALIZATION                                       *
/**********************************************************************
ISPEXEC CONTROL ERRORS RETURN
ISPEXEC VGET DBGSWTCH PROFILE                                                 02
IF &DBGSWTCH = ON THEN +                                                      02
    CONTROL MSG LIST CONLIST SYMLIST NOFLUSH PROMPT ASIS                00000702
ELSE +                                                                        02
    CONTROL NOMSG NOLIST NOFLUSH PROMPT ASIS                            00000902

IF &HELP = HELP THEN GOTO HELPSEC
                                                                              02
/**********************************************************************
/* CHECK TO SEE IF THE USER IS IN ENDEVOR FIRST                       *
/**********************************************************************
IF &BATCH ¬= BATCH THEN +
    DO
        ISPEXEC EDIT DATASET('&SYSUID..ISPF.ISPPROF(CTLIPROF)') +
                MACRO(APPLCHKM)
        IF &LASTCC = 14 THEN +
            DO
                SET ZEDSMSG =
                SET ZEDLMSG = &STR(*** PLEASE EXIT ENDEVOR BEFORE +
                                   EXECUTING "PCKGCHCK" ***)
                ISPEXEC SETMSG MSG(UTLZ001)
                EXIT
            END
    END
                                                                              02
/**********************************************************************
/* GET THE USER'S FULL NAME                                           *
/**********************************************************************
IF &STR(&USER) >      THEN GOTO SETVAR
SET USERID = &STR(&SYSUID)
SET SYSOUTTRAP = 1000
ACF
LIST *
END
SET SYSOUTTRAP = 0
SET SYSDVAL = &STR(&SYSNSUB(1,&SYSOUTLINE1))
READDVAL A B NAME1 NAME2 NAME3 NAME4 NAME5
SET FULLNAME = &STR(&NAME1 &NAME2 &NAME3 &NAME4 &NAME5)
                                                                              02
/**********************************************************************
/* ESTABLISH SOME PROCESSING VARIABLES                                *
/**********************************************************************
SETVAR: +
CALL 'SYS2.USC1.LINKLIB(USERINFO)' '&USERID '
/* CHECK FOR STAGE AND ENVIRONMENT
IF &STAGE = Q THEN +
  SET ENV = QUAL
ELSE +
  DO
    IF &STAGE = M THEN +
      SET ENV = MODO
    ELSE +
      DO
        SET ZEDLMSG = &STR(*** INVALID STAGE PARAMETER ***)
        ISPEXEC SETMSG MSG(UTLZ000)
        EXIT CODE(8)
      END
  END
SET PCKG = &STR(&PACKAGE_ID)
SET COMMENTS = &STR(&PCKG GEN CHCK¦&USERID¦&SYSSDATE¦&SYSSTIME)
SET TMESTAMP = &STR(D)+
               &SUBSTR(1:2,&STR(&SYSSDATE))+
               &SUBSTR(4:5,&STR(&SYSSDATE))+
               &SUBSTR(7:8,&STR(&SYSSDATE))+
               &STR(.T)+
               &SUBSTR(1:2,&STR(&SYSTIME))+
               &SUBSTR(4:5,&STR(&SYSTIME))+
               &SUBSTR(7:8,&STR(&SYSTIME))
SET TEMPJCL = &STR(&USERID..TEMP.PCKGCHCK.&TMESTAMP..JCL)
SET TEMPFILE = &STR(&USERID..TEMP.PCKGCHCK.&TMESTAMP..EXTRACT)
SET TEMPSRT1 = &STR(&USERID..TEMP.PCKGCHCK.&TMESTAMP..SORT1)
SET TEMPSRT2 = &STR(&USERID..TEMP.PCKGCHCK.&TMESTAMP..SORT2)
SET TEMPSRT3 = &STR(&USERID..TEMP.PCKGCHCK.&TMESTAMP..SORT3)
SET TEMPSPRC = &STR(&USERID..TEMP.PCKGCHCK.&TMESTAMP..SUPERC)
SET EXITCC = 0
SET LP = &STR((
SET RP = &STR()

/**********************************************************************
/* INFORM THE USER                                                    *
/**********************************************************************
SET ZEDLMSG = &STR(*** PREPARING TO CALL ENDEVOR TO EXTRACT THE +
                       PACKAGE LIST FOR &PCKG ***)
IF &BATCH = BATCH THEN WRITE &STR(&ZEDLMSG)
ELSE +
    DO
        ISPEXEC CONTROL DISPLAY LOCK
        ISPEXEC DISPLAY PANEL(MSGPANEL)
    END

/**********************************************************************
/* PREPARE FOR A CALL TO ENDEVOR                                      *
/**********************************************************************

/* ALLOCATE ENDEVOR FILES
FREE DDNAME(BSTPDS SMFDATA UNLINPT C1PRINT C1MSGS1)
FREE DDNAME(BSTRPTS BSTLST BSTPCH EXTRACT BSTINP)
FREE DDNAME(SORTIN SORTOUT SORTWK01 SORTWK02 SORTWK03)
ALLOC DD(BSTPDS) DUMMY
ALLOC DD(SMFDATA) DUMMY
ALLOC DD(UNLINPT) DUMMY
ALLOC DD(C1PRINT)  DUMMY

IF &DBGSWTCH = ON THEN +
    ALLOC DD(C1MSGS1)  DA(*)
ELSE +
    ALLOC DD(C1MSGS1)  DUMMY

IF &DBGSWTCH = ON THEN +
    ALLOC DD(BSTRPTS)  DA(*)
ELSE +
    ALLOC DD(BSTRPTS)  DUMMY

IF &DBGSWTCH = ON THEN +
    ALLOC DD(BSTLST)   DA(*)
ELSE +
    ALLOC DD(BSTLST)   DUMMY

ALLOC DD(BSTPCH) +
      NEW DELETE +
      UNIT(SYSDA) VOLUME(WRK$$$) +
      SPACE(1,1) CYLINDERS RELEASE +
      RECFM(F B) LRECL(416) BLKSIZE(4160) DSORG(PS)

DELETE '&TEMPFILE'
ALLOC DD(EXTRACT) +
      DSN('&TEMPFILE') +
      NEW CATALOG +
      UNIT(SYSDA) VOLUME(WRK$$$) +
      SPACE(1,1) CYLINDERS RELEASE +
      RECFM(V B) LRECL(1204) BLKSIZE(12040) DSORG(PS)

ALLOC DD(BSTINP) +
      NEW DELETE +
      UNIT(SYSDA) +
      SPACE(1,1) TRACKS RELEASE +
      RECFM(F B) LRECL(80) BLKSIZE(23440) DSORG(PS)

ALLOC DD(SORTIN) +
      NEW DELETE +
      UNIT(SYSDA) +
      SPACE(1,1) CYLINDERS RELEASE

ALLOC DD(SORTOUT) +
      NEW DELETE +
      UNIT(SYSDA) +
      SPACE(1,1) CYLINDERS RELEASE

ALLOC DD(SORTWK01) +
      NEW DELETE +
      UNIT(SYSDA) +
      SPACE(1,1) CYLINDERS RELEASE

ALLOC DD(SORTWK02) +
      NEW DELETE +
      UNIT(SYSDA) +
      SPACE(1,1) CYLINDERS RELEASE

ALLOC DD(SORTWK03) +
      NEW DELETE +
      UNIT(SYSDA) +
      SPACE(1,1) CYLINDERS RELEASE

/* PREPARE INPUT CARDS FOR ENDEVOR TO EXTRACT PACKAGE FILE
OPENFILE BSTINP    OUTPUT
SET BSTINP = &STR(EXTRACT 72 .)
PUTFILE BSTINP
SET BSTINP = &STR(ENVIRONMENT * .)
PUTFILE BSTINP
SET BSTINP = &STR(PACKAGE &PCKG .)
PUTFILE BSTINP
CLOSFILE BSTINP

SET ZEDLMSG = &STR(*** EXTRACTING THE PACKAGE LIST FOR &PCKG FROM +
                   ENDEVOR ***)
IF &BATCH = BATCH THEN WRITE &STR(&ZEDLMSG)
ELSE +
    DO
        ISPEXEC CONTROL DISPLAY LOCK
        ISPEXEC DISPLAY PANEL(MSGPANEL)
    END

/* CALL ENDEVOR
ISPEXEC SELECT PGM(NDVRC1) PARM(C1BR1000)
SET NDVRCC = &LASTCC

/* FREE ALLOCATED FILES
FREE DDNAME(BSTPDS SMFDATA UNLINPT C1PRINT C1MSGS1)
FREE DDNAME(BSTRPTS BSTLST BSTPCH EXTRACT BSTINP)
FREE DDNAME(SORTIN SORTOUT SORTWK01 SORTWK02 SORTWK03)

/**********************************************************************
/* CHECK IF A VALID PACKAGE WAS ENTERED
/**********************************************************************

/* ALLOCATE EXTRACT
ALLOC DD(EXTRACT) +
      DSN('&TEMPFILE') +
      OLD

/* SET UP ERROR ROUTINE TO TRAP EMPTY EXTRACTS (INVALID PACKAGE ID)
ERROR +
    DO
        ERROR OFF
        SET EXITCC = &NDVRCC
        IF NDVRCC < 8 THEN +
            DO
                SET ZEDLMSG = &STR(*** NO PACKAGE FOUND FOR PACKAGE +
                                   ID &PCKG ***)
                ISPEXEC SETMSG MSG(UTLZ000)
            END
        ELSE +
            DO
                SET ZEDLMSG = &STR(*** ENDEVOR CC: &NDVRCC TRYING TO +
                                   LIST PACKAGE &PCKG ***)
                ISPEXEC SETMSG MSG(UTLZ000)
            END
/*      FREE FILE AND EXIT
        CLOSFILE EXTRACT
        FREE DD(EXTRACT)
        DELETE '&TEMPFILE'
        EXIT CODE(&NDVRCC)
    END

/* CHECK FOR RECORDS IN EXTRACT
OPENFILE EXTRACT INPUT
GETFILE EXTRACT
CLOSFILE EXTRACT

/* TURN OFF ERROR ROUTINE
ERROR OFF

/* FREE EXTRACT
FREE DD(EXTRACT)

/**********************************************************************
/* INFORM THE USER                                                    *
/**********************************************************************
SET ZEDLMSG = &STR(*** GENERATING JCL TO CHECK PACKAGE "&PCKG" ***)
IF &BATCH = BATCH THEN WRITE &STR(&ZEDLMSG)
ELSE +
    DO
        ISPEXEC CONTROL DISPLAY LOCK
        ISPEXEC DISPLAY PANEL(MSGPANEL)
    END

/**********************************************************************
/* GENERATE JCL TO DO THE COMPARE                                     *
/**********************************************************************
DELETE '&TEMPJCL'
FREE DDNAME(ISPFILE)
ALLOCATE DDNAME(ISPFILE) DSN('&TEMPJCL') +
                         NEW CATALOG +
                         UNIT(SYSDA) VOLUME(WRK$$$) +
                         SPACE(1,1) TRACKS RELEASE +
                         RECFM(F B) LRECL(80) BLKSIZE(23440) DSORG(PS)

/* PREPARE JCL USING SKELETON
ISPEXEC FTOPEN
ISPEXEC FTINCL PCKGCHCK
SET SAVECC = &LASTCC
ISPEXEC FTCLOSE

/* FREE JCL FILE
FREE DDNAME(ISPFILE)

IF &EDIT = EDIT THEN +
    DO
        IF &SAVECC > 0 THEN +
            DO
                ISPEXEC VGET ZERRLM
                SET ZEDSMSG = &STR(JCL CREATION ERROR)
                SET ZEDLMSG = &STR(&ZERRLM)
                ISPEXEC SETMSG MSG(UTLZ001)
                ISPEXEC EDIT DATASET('&TEMPJCL')
            END
        ELSE +
            DO
                SET ZEDLMSG = &STR(*** NOTE:  YOU MUST SUBMIT THIS +
                                   JCL YOURSELF ***)
                ISPEXEC SETMSG MSG(UTLZ000W)
                ISPEXEC EDIT DATASET('&TEMPJCL')
            END
    END
ELSE +
    DO
        IF &SAVECC > 0 THEN +
            DO
                ISPEXEC VGET ZERRLM
                SET ZEDSMSG = &STR(JCL CREATION ERROR)
                SET ZEDLMSG = &STR(&ZERRLM)
                ISPEXEC SETMSG MSG(UTLZ001)
                ISPEXEC EDIT DATASET('&TEMPJCL')
            END
        ELSE +
            DO
                SUBMIT '&TEMPJCL'
                SET ZEDSMSG = &STR(JOB SUBMITTED)
                SET ZEDLMSG = &STR(*** THE CREATED JCL WAS SUBMITTED +
                                   ***)
                ISPEXEC SETMSG MSG(UTLZ000)
                DELETE '&TEMPJCL'
            END
    END

/**********************************************************************
/* CLEANUP AND GET OUT                                                *
/**********************************************************************
FINISH: +
EXIT

/**********************************************************************
/* DISPLAY ANY "HELP" WHICH IS AVAILABLE FOR THIS UTILITY             *
/**********************************************************************
HELPSEC: +
ISPEXEC SELECT PGM(ISPTUTOR) PARM(HELPSHEL)
SET ZEDLMSG = &STR(*** HELP DISPLAYED FOR PCKGCHCK UTILITY +
                   *** NO PROCESSING PERFORMED ***)
ISPEXEC SETMSG MSG(UTLZ000)
EXIT
            


Documentation


This utility performs a where-used of all components of an Endevor
package against the LISTA? members of the target environment.

PCKGCHCK executes in ISPF and is invoked as follows:

COMMAND ==> TSO PCKGCHCK xxxxx {edit} {class(l)} {stage(q)}

Where:
  xxxxx    - The Endevor Package ID

  edit     - Keyword that indicates that the created JCL is to be
             edited instead of sumitted

  class(l) - Overides the default job class(5).  If class 5 is
             insufficient, class(l) should be used.

  stage(q) - Overides the default target stage(q).  Valid values are
             Q for Qual, and M for Modo.

The output from this job is on the spool in the OUTDD dataset.  This
file contains the SUPERC-search for output.  This file is the result
of searching for every component in a package in the LISTA? members
of the target environment.
            


Leave a Reply

Your email address will not be published. Required fields are marked *