Mainframe Utility: GDGGEN

Return to Mainframe Utilities Page

Module


/*******************************************************************/
/* CLIST : GDGGEN                                                  */
/* CREATED BY : DAVID LEIGH                                        */
/* DATE : 6-22-89                                                  */
/* DESCRIPTION : THIS CLIST TAKES THE INPUT DATASET AND OUTPUTS    */
/*               THE GDG GEN NODES IN THE FOLLOWING VARIABLES:     */
/*               LIMIT - THE NUMBER OF GENERATIONS ALLOWED FOR THIS*/
/*                       INDEX.                                    */
/*               GEN - HOW MANY DATASETS ARE ASSOCIATED WITH THIS  */
/*                     INDEX.                                      */
/*               ZEROGEN - THE CURRENT "0" GENERATION DATASET.     */
/*               NEXTGEN - WHAT THE "+1" DATASET WOULD BE CALLED   */
/*                         GIVEN THE CURRENT INDEX STATUS.         */
/*               MINUS0 - THE NAMES OF EACH OF THE EXISTING ACTUAL */
/*                THRU    DATASETS FOR THIS INDEX.  MINUS0 WILL BE */
/*               MINUSX   THE SAME AS ZEROGEN.  "X" IN "MINUSX" IS */
/*                        EQUAL TO "GEN - 1".                      */
/*               ALL OF THESE VARIABLES ARE THEN "VPUT" INTO THE   */
/*               ISPF SHARED POOL.                                 */
/*               IF THIS CLIST IS CALLED FROM THE COMMAND LINE,    */
/*               THE USER WILL BE PROMPTED FOR A GDG INDEX BASE    */
/*               NAME, AND THE INFORMATION WILL BE DISPLAYED AT    */
/*               THE TERMINAL.                                     */
/*******************************************************************/
PROC 0 DSN() EXCODE(0) HELP DEBUG
/**** SET MESSAGE DISPLAY ON/OFF BASED ON THE DEBUG SWITCH ***/
IF &DEBUG = DEBUG THEN CONTROL MSG LIST CONLIST SYMLIST NOFLUSH
ELSE  CONTROL NOMSG NOLIST NOFLUSH NOPROMPT
IF &HELP = &STR(HELP) THEN GOTO HELPSEC

IF &SYSNEST = NO AND &STR(&DSN) =     THEN +
    DO
        WRITENR ENTER GDG INDEX BASE NAME ==>
        READ DSN
        IF &STR(&DSN) =    THEN +
            DO
                SET ZEDLMSG = &STR(*** NO DATASET NAME ENTERED *** +
                                   NO PROCESSING PERFORMED)
                IF &SYSISPF = ACTIVE THEN ISPEXEC SETMSG MSG(UTLZ001)
                ELSE WRITE &STR(&ZEDLMSG)
                EXIT
            END
    END

IF &SYSNEST = YES AND &STR(&DSN) =    THEN EXIT CODE(12)

SET SYSOUTTRAP = 1000
LISTCAT ENTRY('&DSN') GDG ALL
SET EXCODE = &LASTCC
SET SYSOUTTRAP = 0

IF &EXCODE > 4 THEN +
    DO
        SET ZEDLMSG = &STR("&DSN" ERROR : &SYSDSN('&DSN'))
        IF &SYSISPF = ACTIVE THEN ISPEXEC SETMSG MSG(UTLZ001)
        ELSE WRITE &STR(&ZEDLMSG)
        EXIT CODE(&EXCODE)
    END

SET GEN = 0
SET ALLVAR = &STR(LIMIT GEN)
SET I = &SYSOUTLINE

DO WHILE &I > 0
    SET SYSUT2 = &STR(&&SYSOUTLINE&I)
    SET LEN = &LENGTH(&STR(&SYSUT2))
    SELECT
        WHEN (&SUBSTR(7:13,&STR(&SYSUT2)) = &STR( LIMIT-)) DO
            SET LIMIT = &SUBSTR(31:31,&STR(&SYSUT2))
            IF &DATATYPE(&SUBSTR(30:30,&STR(&SYSUT2))) = NUM THEN +
                SET LIMIT = &STR(&SUBSTR(30:30,&STR(&SYSUT2))&LIMIT)
            IF &DATATYPE(&SUBSTR(29:29,&STR(&SYSUT2))) = NUM THEN +
                SET LIMIT = &STR(&SUBSTR(29:29,&STR(&SYSUT2))&LIMIT)
            SET LIMIT = &LIMIT
            SET I = 0
        END
        WHEN (&SUBSTR(7:16,&STR(&SYSUT2)) = &STR( NONVSAM--)) DO
            SET MINUS&GEN = &SUBSTR(17:&LEN,&STR(&SYSUT2))
            IF &GEN = 0 THEN +
                DO

                    SET ZEROGEN = &STR(&MINUS0)
                    SET ALLVAR = &STR(&ALLVAR ZEROGEN NEXTGEN)
                    SET X = &LENGTH(&STR(&ZEROGEN))
                    SET Y = &X - 1
                    SET VER = &SUBSTR(&Y:&X,&STR(&ZEROGEN))
                    SET Y = &X - 3
                    SET Z = &X - 6
                    SET XGEN = &SUBSTR(&Z:&Y,&STR(&ZEROGEN))
                    SET XGEN = &XGEN + 1
                    IF &XGEN > 9999 THEN +
                        DO
                            SET VER = &VER + 1
                            SET XGEN = 1
                        END
                    SET NEXTGEN = &STR(&SUBSTR(1:+
                                       &LENGTH(&STR(&ZEROGEN))-8,+
                                       &STR(&ZEROGEN))+
                                       G&SUBSTR(+
                                       &LENGTH(&STR(000&XGEN))-3:+
                                       &LENGTH(&STR(000&XGEN)),+
                                       &STR(000&XGEN))+
                                       V&SUBSTR(&LENGTH(&STR(0&VER))-1:+
                                       &LENGTH(&STR(0&VER)),+
                                       &STR(000&VER)))
                END
            SET ALLVAR = &STR(&ALLVAR MINUS&GEN)
            SET GEN = &GEN + 1
        END
    END
    SET I = &I - 1
END

IF &STR(&ZEROGEN) =     THEN +
    DO
        SET NEXTGEN = &STR(&DSN..G0001V00)
        SET ALLVAR = &STR(&ALLVAR NEXTGEN)
        SET EXCODE = 4
    END

IF &SYSISPF ¬= ACTIVE OR &SYSNEST = NO THEN +
    DO
        WRITE BASE(&DSN)
        WRITE LIMIT(&LIMIT)
        WRITE GEN(&GEN)
        WRITE ZEROGEN(&ZEROGEN)
        WRITE NEXTGEN(&NEXTGEN)
        DO &I = 0 TO &EVAL(&GEN - 1)
            SET X = &&MINUS&I
            WRITE MINUS&I(&X)
        END
    END
ELSE  +
    ISPEXEC VPUT (&ALLVAR) SHARED

EXIT CODE(&EXCODE)

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


Documentation

 This utility can be called from a CLIST to evaluate relative GDG generation
 numbers for a dataset, and convert them into "GOOVOO's" to enable the CLIST to
 process the dataset.  When you invoke GDGGEN you pass the keyword parm "DSN".
 GDGGEN will then VPUT the following variables into the SHARED pool.
 
 LIMIT - The number of generations allowed for this GDG index.
 
 NEXTGEN - The GOOVOO for the "+1" version of the dataset.
 
 MINUS0 thru MINUS999 (where 999 = the LIMIT of this index) - The GOOVOO for
 each relative generation number on the index.            


Leave a Reply

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