Mainframe Utility: SCRATCH

Return to Mainframe Utilities Page

Module


/**********************************************************************
/* UTILITY: SCRATCH                                                   *
/* AUTHOR: DAVID LEIGH                                                *
/* FUNCTION: CREATE A BATCH JOB FOR SCRATCHING TAPE DATASETS EN MASSE.*
/**********************************************************************
PROC 0 HELP DSNQUAL() UTILITY(SCRATCH)
/*** CHECK THE DEBUG SWITCH ***/
ISPEXEC VGET DBGSWTCH PROFILE
IF &DBGSWTCH = ON THEN +
    CONTROL MSG LIST CONLIST SYMLIST NOFLUSH NOPROMPT ASIS
ELSE +
    CONTROL NOMSG NOLIST NOFLUSH NOPROMPT ASIS

/**********************************************************************
/* TELL THE USER WHAT'S HAPPENING                                     *
/**********************************************************************
SET ZEDLMSG = &STR(*** INITIALIZATION ***)
ISPEXEC CONTROL DISPLAY LOCK
ISPEXEC DISPLAY PANEL(MSGPANEL)

/**********************************************************************
/* CREATE THE TABLE                                                   *
/**********************************************************************
ISPEXEC TBCREATE TEMPTABL NOWRITE REPLACE KEYS() NAMES(DATASET)

/**********************************************************************
/* GET USER INFORMATION                                               *
/**********************************************************************
CALL 'SYS2.USC1.LINKLIB(USERINFO)' '&SYSUID '
ISPEXEC VGET (BINNM,CCNTR) PROFILE
SET SYSOUTTRAP = 1000
ACF
LIST *
END
SET SYSOUTTRAP = 0
SET SYSDVAL = &SYSOUTLINE1
READDVAL A B NAME1 NAME2 NAME3 NAME4 NAME5
SET NAME = &STR(&NAME1)
IF &STR(&NAME2) >    THEN SET NAME = &STR(&NAME &NAME2)
IF &STR(&NAME3) >    THEN SET NAME = &STR(&NAME &NAME3)
IF &STR(&NAME4) >    THEN SET NAME = &STR(&NAME &NAME4)
IF &STR(&NAME5) >    THEN SET NAME = &STR(&NAME &NAME5)
SET LNAME = &LENGTH(&STR(&NAME))

/**********************************************************************
/* GET DATE INFORMATION                                               *
/**********************************************************************
SET DUFUNC   = CONVERT
SET DUNUMBER =
SET DUDATE1  = &STR(&SYSSDATE)
SET DUDY1FMT = DD
SET DUMO1FMT = MM
SET DUYR1FMT = YY
SET DUDT1FMT = &STR(Y/M/D)
SET DUDY2FMT = ZD
SET DUMO2FMT = MONTH
SET DUYR2FMT = YYYY
SET DUDT2FMT = &STR(M D, Y)

ISPEXEC VPUT (DUFUNC DUDATE1 DUDY1FMT DUMO1FMT DUYR1FMT DUDT1FMT +
              DUNUMBER DUDY2FMT DUMO2FMT DUYR2FMT DUDT2FMT) SHARED

ISPEXEC SELECT PGM(DATEUTIL) PARM(ISPF)
SET PGMCC = &LASTCC

IF &PGMCC = 0 THEN ISPEXEC VGET DUDATE2 SHARED
ELSE SET DUDATE2 = &STR(&SYSSDATE)

/**********************************************************************
/* WHICH "DSNQUAL" ARE WE GOING TO USE                                *
/**********************************************************************
IF &STR(&DSNQUAL) =     THEN SET DSNQUAL = &SYSUID

/**********************************************************************
/* SET SOME VARIABLES                                                 *
/**********************************************************************
SET LINE1 = &STR( +------------------------------------)+
            &STR(-----------------------------------------+)
SET LINE2 = &STR( ¦                                    )+
            &STR(                                         ¦)
SET LINE3 = &STR( ¦                       T M S    U P )+
            &STR(D A T E    F O R M                       ¦)
SET LINE4 = &STR( ¦                                    )+
            &STR(                                         ¦)
SET LINE5 = &STR( ¦------------------------------------)+
            &STR(-----------------------------------------¦)
SET LINE6 = &STR( ¦VOLSER¦DATA SET NAME / NEW DATA  )+
            &STR(SET NAME      ¦SCRATCH¦ NEW EXPIRATION DATE ¦)
SET LASTLINE = &STR( +------------------------------------)+
               &STR(-----------------------------------------+)
SET SEPARATE = &STR( ¦------+--------------------------)+
               &STR(--------------+-------+---------------------¦)
SET SUFFIX = &STR(¦  YES  ¦                     ¦)
IF &LNAME > 45 THEN SET X = &LNAME + 13
ELSE SET X = 61
SET AST =
SET SPC =
DO &I = 1 TO &X
    SET AST = &STR(&AST*)
    SET SPC = &STR(&SPC )
END
SET SPC = &STR(*)&SUBSTR(2:&X-1,&STR(&SPC))&STR(*)
SET X = &EVAL((80-&X)/2)
SET PFX =
DO &I = 1 TO &X
    SET PFX = &STR(&PFX )
END
SET HEAD1 =  &STR(1)
SET HEAD2 =  &STR(&PFX&AST)
SET HEAD3 =  &STR(&PFX&SPC)
SET HEAD4 =  &STR(&PFX* TO:      COMPUTER ROOM BUILDING "D")
SET L = &EVAL(&LENGTH(&STR(&HEAD2))-&LENGTH(&STR(&HEAD4)))
SET SFX =
DO &I = 1 TO &L-1
    SET SFX = &STR(&SFX )
END
SET HEAD4 = &STR(&HEAD4&SFX*)
SET HEAD5 =  &STR(&PFX&SPC)
SET HEAD6 =  &STR(&PFX* FROM:    &NAME)
SET L = &EVAL(&LENGTH(&STR(&HEAD2))-&LENGTH(&STR(&HEAD6)))
SET SFX =
DO &I = 1 TO &L-1
    SET SFX = &STR(&SFX )
END
SET HEAD6 = &STR(&HEAD6&SFX*)
SET HEAD7 =  &STR(&PFX&SPC)
SET HEAD8 =  &STR(&PFX* DATE:    &DUDATE2)
SET L = &EVAL(&LENGTH(&STR(&HEAD2))-&LENGTH(&STR(&HEAD8)))
SET SFX =
DO &I = 1 TO &L-1
    SET SFX = &STR(&SFX )
END
SET HEAD8 = &STR(&HEAD8&SFX*)
SET HEAD9 =  &STR(&PFX&SPC)
SET HEAD10 = &STR(&PFX* SUBJECT: PLEASE SCRATCH THE ATTACHED +
                                 LIST OF TAPES IN TMS)
SET L = &EVAL(&LENGTH(&STR(&HEAD2))-&LENGTH(&STR(&HEAD10)))
SET SFX =
DO &I = 1 TO &L-1
    SET SFX = &STR(&SFX )
END
SET HEAD10 = &STR(&HEAD10&SFX*)
SET HEAD11 = &STR(&PFX&SPC)
SET HEAD12 = &STR(&PFX&AST)
SET HEAD13 = &STR(1)

/**********************************************************************
/* TELL THE USER WHAT'S HAPPENING                                     *
/**********************************************************************
SET ZEDLMSG = &STR(*** FINDING ANY "&DSNQUAL" TAPE DATASETS ***)
ISPEXEC CONTROL DISPLAY LOCK
ISPEXEC DISPLAY PANEL(MSGPANEL)

/**********************************************************************
/* GET THE SYSUID DATASET NAMES                                       *
/**********************************************************************
CONTROL MSG
SET SYSOUTTRAP = 10000
LISTCAT VOLUME LEVEL(&DSNQUAL)
SET SYSOUTTRAP = 0
SET A = &SYSOUTLINE
CONTROL NOMSG

/**********************************************************************
/* LOAD THE TABLE WITH THESE                                          *
/**********************************************************************
DO &B = 1 TO &A
    SET SYSDVAL = &STR(&SYSNSUB(2,&&SYSOUTLINE&B))
    READDVAL PARMA PARMB PARMC PARMD
    SELECT
        WHEN (&STR(&PARMA)=&STR(NONVSAM)) SET DATASET = &STR(&PARMC)
        WHEN (&SYSINDEX(&STR(VOLSER-),&STR(&PARMA))>0) DO
            SET VOLUME = &SUBSTR(&LENGTH(&STR(&PARMA))-5:+
                                 &LENGTH(&STR(&PARMA)),+
                                 &STR(&PARMA))
            IF &DATATYPE(&VOLUME) = CHAR THEN SET VOLUME =
        END
        OTHERWISE SET VOLUME =
    END
    IF &STR(&VOLUME) >      THEN +
        DO
            SET DATASET = &STR( &DATASET)+
                          &STR(          )+
                          &STR(          )+
                          &STR(          )+
                          &STR(          )
            SET DATASET = &STR( ¦&VOLUME¦)+
                          &SUBSTR(1:40,+
                          &STR(&DATASET))+
                          &STR(&SUFFIX)
            ISPEXEC TBADD TEMPTABL
            SET VOLUME =
        END
END

/**********************************************************************
/* TELL THE USER WHAT'S HAPPENING                                     *
/**********************************************************************
SET ZEDLMSG = &STR(*** FINDING ANY "T.&DSNQUAL" TAPE DATASETS ***)
ISPEXEC CONTROL DISPLAY LOCK
ISPEXEC DISPLAY PANEL(MSGPANEL)

/**********************************************************************
/* GET THE T.SYSUID DATASET NAMES                                     *
/**********************************************************************
CONTROL MSG
SET SYSOUTTRAP = 10000
LISTCAT VOLUME LEVEL(T.&DSNQUAL)
SET SYSOUTTRAP = 0
SET A = &SYSOUTLINE
CONTROL NOMSG

/**********************************************************************
/* LOAD THE TABLE WITH THESE                                          *
/**********************************************************************
/*IF &SYSUID = D@UDAL THEN CONTROL MSG LIST CONLIST SYMLIST
DO &B = 1 TO &A
    SET SYSDVAL = &STR(&SYSNSUB(2,&&SYSOUTLINE&B))
    READDVAL PARMA PARMB PARMC PARMD
    SELECT
        WHEN (&STR(&PARMA)=&STR(NONVSAM)) SET DSN = &STR(&PARMC)
        WHEN (&SYSINDEX(&STR(VOLSER-),&STR(&PARMA))>0) DO
            SET VOLUME = &SUBSTR(&LENGTH(&STR(&PARMA))-5:+
                                 &LENGTH(&STR(&PARMA)),+
                                 &STR(&PARMA))
            IF &DATATYPE(&VOLUME) = CHAR THEN SET VOLUME =
        END
        OTHERWISE SET VOLUME =
    END
    IF &STR(&VOLUME) >      THEN +
        DO
            SET DATASET = &STR( &DSN)+
                          &STR(          )+
                          &STR(          )+
                          &STR(          )+
                          &STR(          )
            SET DATASET = &STR( ¦&VOLUME¦)+
                          &SUBSTR(1:40,+
                          &STR(&DATASET))+
                          &STR(&SUFFIX)
            ISPEXEC TBADD TEMPTABL
            SET VOLUME =
        END
END

/**********************************************************************
/* TELL THE USER WHAT'S HAPPENING                                     *
/**********************************************************************
SET ZEDLMSG = &STR(*** FINDING ANY "T.OFF.&DSNQUAL" TAPE DATASETS ***)
ISPEXEC CONTROL DISPLAY LOCK
ISPEXEC DISPLAY PANEL(MSGPANEL)

/**********************************************************************
/* GET THE T.SYSUID DATASET NAMES                                     *
/**********************************************************************
CONTROL MSG
SET SYSOUTTRAP = 10000
LISTCAT VOLUME LEVEL(T.OFF.&DSNQUAL)
SET SYSOUTTRAP = 0
SET A = &SYSOUTLINE
CONTROL NOMSG

/**********************************************************************
/* LOAD THE TABLE WITH THESE                                          *
/**********************************************************************
DO &B = 1 TO &A
    SET SYSDVAL = &STR(&SYSNSUB(2,&&SYSOUTLINE&B))
    READDVAL PARMA PARMB PARMC PARMD
    SELECT
        WHEN (&STR(&PARMA)=&STR(NONVSAM)) SET DATASET = &STR(&PARMC)
        WHEN (&SYSINDEX(&STR(VOLSER-),&STR(&PARMA))>0) DO
            SET VOLUME = &SUBSTR(&LENGTH(&STR(&PARMA))-5:+
                                 &LENGTH(&STR(&PARMA)),+
                                 &STR(&PARMA))
            IF &DATATYPE(&VOLUME) = CHAR THEN SET VOLUME =
        END
        OTHERWISE SET VOLUME =
    END
    IF &STR(&VOLUME) >      THEN +
        DO
            SET DATASET = &STR( &DATASET)+
                          &STR(          )+
                          &STR(          )+
                          &STR(          )+
                          &STR(          )
            SET DATASET = &STR( ¦&VOLUME¦)+
                          &SUBSTR(1:40,+
                          &STR(&DATASET))+
                          &STR(&SUFFIX)
            ISPEXEC TBADD TEMPTABL
            SET VOLUME =
        END
END

/**********************************************************************
/* GET OUT IF NO TAPES WERE FOUND                                     *
/**********************************************************************
ISPEXEC TBSTATS TEMPTABL ROWCURR(NUMROWS)
IF &NUMROWS < 1 THEN +
    DO
        SET ZEDLMSG = &STR(*** NO "&DSNQUAL" TAPE DATASETS FOUND ***)
        ISPEXEC SETMSG MSG(UTLZ001W)
        EXIT
    END

/**********************************************************************
/* TELL THE USER WHAT'S HAPPENING                                     *
/**********************************************************************
SET ZEDLMSG = &STR(*** CREATING THE TMS UPDATE FORM ***)
ISPEXEC CONTROL DISPLAY LOCK
ISPEXEC DISPLAY PANEL(MSGPANEL)

/**********************************************************************
/* CREATE THE TMS UPDATE FORM                                         *
/**********************************************************************
SET TEMPFORM = &STR(&SYSUID..TEMP.TMS.FORM)
DELETE '&TEMPFORM'
FREE DDNAME(ISPFILE)
ALLOCATE DDNAME(ISPFILE) DSN('&TEMPFORM') +
         NEW CATALOG +
         UNIT(SYSDA) VOLUME(WRK$$$) +
         SPACE(1,1) CYLINDERS RELEASE +
         RECFM(F B A) LRECL(80) BLKSIZE(23440) DSORG(PS)

ISPEXEC FTOPEN
ISPEXEC FTINCL SCRATCH
SET SAVECC = &LASTCC
ISPEXEC FTCLOSE
FREE DDNAME(ISPFILE)

IF &SAVECC > 0 THEN +
    DO
        ISPEXEC VGET ZERRLM
        SET ZEDSMSG = &STR(FORM CREATION ERROR)
        SET ZEDLMSG = &STR(&ZERRLM)
        ISPEXEC SETMSG MSG(UTLZ001)
    END
ELSE +
    DO
        SET ZEDLMSG = &STR(REVIEW RESULTS, DELETE UNNEEDED LINES, +
                           SAVE, TYPE PRINTIT ON +
                           CMD LINE TO PRINT)
        ISPEXEC SETMSG MSG(UTLZ001W)
        ISPEXEC EDIT DATASET('&TEMPFORM')
    END

ISPEXEC TBEND TEMPTABL

EXIT


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


Documentation


 SCRATCH searches the MVS CATALOG for tape volumes for datasets of a given
 "dsnqual" or high-level qualifier and creates a TMS UPDATE FORM automatically.

 Note: the above statement means that un-cataloged tape volumes are not found,
 and sometimes catalog entries can remain even when the underlying volume has
 been re-used.  A $TINFO utility run against that catalog entry in 3.4 can
 reveal whether or not this has happend.  TMS utilities must be used to identify
 un-cataloged tape volumes which are not yet scratched.

 In keeping with UNIPAC's tape standards, in addition to looking for tape
 volumes beginning with a certain "dsnqual", it also looks for datasets
 beginning T.dsnqual and T.OFF.dsnqual.

 If you do not specify a "dsnqual" when invoking SCRATCH, it will look for your
 TSO id as the "dsnqual".

 Once SCRATCH has created the TMS UPDATE FORM, you are taken into an edit on the
 file containing the form.  Since SCRATCH does not know which tapes you really
 want to scratch, you must DELETE ANY TAPES ON THE LIST THAT YOU WANT TO KEEP!

 Once you've pared down the list of tape datasets, you can save the dataset
 (type SAVE on the command line and press ENTER), and print it off (an easy way
 to do this is to type PRINTIT on the command line and press ENTER).

 Per UNIPAC procedures, you must sign the form and your supervisor must sign the
 form.  Since the form already contains distribution routing information, you
 can just drop your signed form in a distribution bin and that's that!

 To invoke SCRATCH, simply type:

 tso scratch

 on the command line and press ENTER.

 If you want to specify a specific dsnqual, simply type:
                              +-------------------------------------+
 tso scratch dsnqual(?????)   ³where "?????" might be something like³
                              ³"TST2B" or "TST28"                   ³
                              +-------------------------------------+
 on the command line and press ENTER.
            


Leave a Reply

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