Mainframe Utility: $TDATE

Return to Mainframe Utilities Page

Module


PROC 1 TDSN                                                             --------
/*** 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
IF &STR(&TDSN) = HELP THEN GOTO HELPSEC
/**********************************************************************
/* UTILITY: $TDATE                                                    *
/* AUTHOR: DAVID LEIGH                                                *
/* FUNCTION: CALL "TMSBINQ" TO FIND OUT THE CREATE DATE ON A TAPE     *
/*           DATASET AND PLACE IT INTO TMS.                           *
/**********************************************************************

IF &SYSINDEX(&STR('),&STR(&TDSN)) = 1 THEN +
    SET TDSN = &SUBSTR(2:&LENGTH(&STR(&TDSN))-1,&STR(&TDSN))
ELSE +
    SET TDSN = &STR(&SYSUID..&TDSN)

SET ZEDLMSG = &STR(*** GETTING CREATE DATE FOR "&TDSN" ***)
ISPEXEC CONTROL DISPLAY LOCK
ISPEXEC DISPLAY MSG(UTLZ000W)

SET SYSRPTDSN = &STR(&SYSUID..TEMP.TMS.REPORT)

DELETE '&SYSRPTDSN'

FREE DDNAME(TMSRPT SYSIN)

ALLOC DD(TMSRPT) DSN('&SYSRPTDSN') +
                 NEW CATALOG +
                 UNIT(SYSDA) VOLUME(WRK$$$) +
                 SPACE(5,5) TRACKS RELEASE +
                 DSORG(PS) RECFM(F B) LRECL(133) BLKSIZE(23408)

ALLOC DD(SYSIN) +
      NEW +
      UNIT(SYSDA) VOLUME(WRK$$$) +
      SPACE(1,1) TRACKS RELEASE +
      RECFM(F B) LRECL(80) BLKSIZE(23440) DSORG(PS)

OPENFILE SYSIN  OUTPUT
SET SYSIN  = &STR(DSN=&TDSN,LONG)
PUTFILE SYSIN
CLOSFILE SYSIN

ISPEXEC SELECT PGM(TMSBINQ)

FREE DDNAME(SYSIN SYSPRINT)

/**********************************************************************
/* PARSE THE OUTPUT FILE FOR THE DATA WE'RE LOOKING FOR               *
/**********************************************************************
ERROR DO
    SET ERRCC = &LASTCC
    SELECT (&ERRCC)
        WHEN (400) DO
            SET EOF = YES
            RETURN
        END
        OTHERWISE DO
            ERROR OFF
            WRITE *** ERROR CC: &ERRCC OCCURRED READING A FILE ***
            CLOSFILE TMSRPT
            FREE DD(TMSRPT)
            EXIT
        END
    END
END

SET SWITCH = OFF
SET EOF = NO
OPENFILE TMSRPT
GETFILE TMSRPT

DO WHILE &EOF = NO
    IF &SYSINDEX(&STR( DSN=&TDSN),&STR(&SYSNSUB(1,&TMSRPT))) > 0 AND +
       &SYSINDEX(&STR( DSN=&TDSN),&STR(&SYSNSUB(1,&TMSRPT))) < 30 THEN +
        DO
GETLOOP:    GETFILE TMSRPT
            IF &SYSINDEX(&STR(CDATE=),&STR(&SYSNSUB(1,&TMSRPT))) > 0 +
                THEN DO
                    SET A = +
                       &SYSINDEX(&STR(CDATE=),&STR(&SYSNSUB(1,&TMSRPT)))
                    SET A = &A + 6
                    SET Y = &A + 9
                    SET DATE = &SUBSTR(&A:&Y,&STR(&SYSNSUB(1,&TMSRPT)))
                    SET DATE = &SUBSTR(9:10,&STR(&DATE))+
                               &SUBSTR(1:2,&STR(&DATE))+
                               &SUBSTR(4:5,&STR(&DATE))
                    SET B = +
                       &SYSINDEX(&STR(CTIME=),&STR(&SYSNSUB(1,&TMSRPT)))
                    SET B = &B + 6
                    SET X = &B + 4
                    SET TIME = &SUBSTR(&B:&X,&STR(&SYSNSUB(1,&TMSRPT)))
                    SET ZDLMSG = &STR(D=&DATE T=&TIME)
                    ISPEXEC VPUT ZDLMSG
                    GOTO FINISH
                END
            ELSE GOTO GETLOOP
        END
    GETFILE TMSRPT
END

FINISH: +
ERROR OFF
CLOSFILE TMSRPT
FREE DD(TMSRPT)

EXIT

HELPSEC: +                                                              02480000
ISPEXEC SELECT PGM(ISPTUTOR) PARM(HELPSHEL)                             02490000
SET ZEDLMSG = &STR(*** HELP DISPLAYED FOR $TDATE UTILITY +              02490000
                   *** NO PROCESSING PERFORMED ***)                     02490000
ISPEXEC SETMSG MSG(UTLZ000)                                             02490000
EXIT
            


Documentation


 $TDATE is designed to be used specifically in the ISPF option 3.4 screen.  By
 placing $TDATE (or the alias $TD) next to a tape dataset name on the dataset
 list screen and pressing enter, the create date and time of the tape dataset
 will be displayed.  This is not an instantaneous process, as TMS must be
 queried to get this information, but it is fairly quick.  The create date and
 time will placed next to the dataset name in the format of "D=yyddd T=hhmm" (24
 hour clock).
            


Leave a Reply

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