Mainframe Utility: BLDG

Return to Mainframe Utilities Page

Module


/**********************************************************************/
/* UTILITY NAME : BLDG                                                */
/* DATE WRITTEN : ?                                                   */
/* AUTHOR       : DAVE LEIGH (ENHANCED VERSION OF PLANO WRITTEN CLIST */
/* DESCRIPTION  : LIST, BUILD, AND DELETE GDG INDEXES.                */
/**********************************************************************/
PROC 0 FUNC(B) DSN() ENT(3) SYSPRINT SILENT HELP
/*** CHECK THE DEBUG SWITCH ***/
CONTROL NOMSG NOLIST NOFLUSH NOPROMPT ASIS
ISPEXEC CONTROL ERRORS RETURN
/**********************************************************************
/* CONTROL CLIST/EDIT MODE PROCESSING                                 *
/**********************************************************************
ERROR DO
          SET MODE = CLIST
          RETURN
      END
ISREDIT MACRO
ERROR OFF


/**** SET MESSAGE DISPLAY ON/OFF BASED ON THE DEBUG SWITCH ***/
ISPEXEC VGET (DBGSWTCH) PROFILE
IF &DBGSWTCH = &STR(ON) THEN CONTROL MSG LIST CONLIST SYMLIST NOFLUSH
ELSE CONTROL NOMSG NOLIST NOFLUSH NOPROMPT
IF &HELP = &STR(HELP) THEN +
    GOTO HELPSEC

IF &MODE ¬= CLIST THEN GOTO PARSE_DSN

IF &DSN =   THEN +
    GOTO PREMAP
ELSE +
    DO
        SET PARM = YES
        IF &SYSPRINT =    THEN SET SYSPRINT = N
        IF &FUNC = B THEN GOTO BREAD
        IF &FUNC = L THEN GOTO LREAD
        IF &FUNC = D THEN GOTO DREAD
    END

PREMAP: +
ISPEXEC VGET DSN SHARED
SET BUILD = X
SET ENT = 3
SET LIST =
SET DELETE =
SET SYSPRINT = N

ISPEXEC VPUT (DSN BUILD ENT DELETE LIST SYSPRINT) SHARED

START: +
ISPEXEC DISPLAY PANEL(UTILBLDG)
IF &LASTCC = 8 THEN +
    DO
        IF &MODE ¬= CLIST THEN ISREDIT CURSOR = &LN &CL
        EXIT
    END
ELSE +
    DO
        ISPEXEC VGET (DSN BUILD ENT DELETE LIST SYSPRINT) SHARED
        IF &SYSPRINT = Y THEN SET SYSPRINT = SYSPRINT
        IF &BUILD  >    THEN GOTO BREAD
        IF &DELETE >    THEN GOTO DREAD
        IF &LIST   >    THEN GOTO LREAD
    END

LREAD: +
LISTCAT ENTRY('&DSN') GDG ALL

IF &LASTCC = 0 THEN +
  DO
     SET ZEDLMSG = LISTCAT ON "&DSN" SUCCESSFUL
     GOTO EXITEND
  END
ELSE SET ZEDLMSG = LISTCAT ON "&DSN" UNSUCCESSFUL
GOTO EXITEND

BREAD: +
SET DSNTEXT = &STR(&SYSDSN('&DSN'))
LISTDSI '&DSN'
SET CCLISTDSI = &LASTCC
SET SYSOUTTRAP = 1000
LISTCAT ENTRY('&DSN') GDG ALL
SET CCLISTCAT = &LASTCC
SET SYSOUTTRAP = 0

SELECT
    WHEN (&CCLISTDSI = 16     AND +
          &CCLISTCAT = 0) DO
        SET ZEDLMSG = "&DSN" IS ALREADY A GDG
        IF &SILENT = SILENT THEN SET EXITCODE = 4
        GOTO EXITEND
    END
    WHEN (&STR(&DSNTEXT) = OK AND +
          &CCLISTDSI = 0      AND +
          &CCLISTCAT = 4) DO
        SET ZEDLMSG = "&DSN" IS ALREADY ALLOCATED AND IS NOT A GDG
        IF &SILENT = SILENT THEN SET EXITCODE = 8
        GOTO EXITEND
    END
    OTHERWISE DO
        IF &LENGTH(&ENT) = 0 THEN +
            DO
                WRITENR ENTER NUMBER OF GDG ENTRIES REQUIRED ==>
                READ &ENT
            END
        DEFINE GDG(NAME('&DSN') NOEMPTY SCRATCH LIMIT(&ENT))
        SET CCDEFINE = &LASTCC
        IF &CCDEFINE ¬= 0 THEN +
            DO
                SET ZEDLMSG = &STR(*** GDG DEFINITION OF "&DSN" +
                                   FAILED WITH RETURN CODE OF +
                                   "&CCDEFINE" ***)
                IF &SILENT = SILENT THEN SET EXITCODE = 12
                GOTO EXITEND
            END
        SET ZEDLMSG = GDG INDEX FOR "&DSN" CREATED WITH "&ENT" ENTRIES
        IF &SILENT = SILENT THEN SET EXITCODE = 0
        GOTO EXITEND
    END
END

DREAD: +
DELETE '&DSN' GDG
IF &LASTCC > 0 OR &LASTCC < 0 THEN +
   DO
      WRITE
      WRITE   GDG INDEX FOR  "&DSN" WAS NOT DELETED
      WRITE
      WRITE  1) A GDG INDEX CANNOT BE DELETED UNLESS IT IS EMPTY.
      WRITE
      WRITE  2) A NON GDG DATA SET CANNOT BE DELETED HERE.
      WRITE
      WRITE  3) THERE IS NO GDG INDEX FOR THIS DSN.
      WRITE
      WRITE  4) YOU DO NOT HAVE AUTHORITY TO DELETE THIS ENTRY.
      WRITE
      WRITE           FUNCTION TERMINATED
      SET ZEDLMSG = COULD NOT DELETE "&DSN" GDG INDEX
      GOTO EXITEND
   END
SET ZEDLMSG = GDG INDEX FOR "&DSN" HAS BEEN DELETED
GOTO EXITEND

EXITEND: +
IF &PARM = YES THEN +
    DO
        IF &SILENT = SILENT THEN EXIT CODE(&EXITCODE)
        WRITE &ZEDLMSG
        EXIT
    END

ISPEXEC SETMSG MSG(UTLZ000)
GOTO START

/**********************************************************************
/* PARSE THE DATASET NAME                                             *
/**********************************************************************
PARSE_DSN: +
SET BUILD = X
SET DELETE =
SET LIST =
SET SYSPRINT = N
SET LP = &STR((
SET RP = &STR())

ISREDIT (LN,CL) = CURSOR
ISREDIT (DSN) = LINE .ZCSR

SET SYSDVAL = &SUBSTR(&CL:&LENGTH(&NRSTR(&DSN)),&NRSTR(&DSN))
READDVAL DSN

SET Y = &SYSINDEX(&STR(&LP),&STR(&DSN))

IF &Y > 0 THEN +
    SET DSN = &SUBSTR(1:&Y-1,&STR(&DSN))

SET X = &LENGTH(&STR(&DSN))

DO WHILE +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(.) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(?) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(") OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(') OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(:) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(;) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(&&) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(~) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(`) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(|) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(%) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(ª) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(*) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(_) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(-) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(=) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(+) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(!) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(?) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(?) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR() OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR({) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(}) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(/) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(>) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(<) OR +
   &SUBSTR(&X:&X,&STR(&DSN)) = &STR(&LP) OR +
   &SUBSTR(&X-1:&X,&STR(&DSN)) = &STR(&RP&RP) OR +
   &SUBSTR(&X-1:&X,&STR(&DSN)) = &STR(&LP&RP) OR +
   &SUBSTR(&X-1:&X,&STR(&DSN)) = &STR('&RP) OR +
   &SUBSTR(&X-1:&X,&STR(&DSN)) = &STR(&RP&LP) OR +
  (&SUBSTR(&X:&X,&STR(&DSN)) = &STR(&RP) AND +
  (&SYSINDEX(&STR(&LP),&STR(&DSN)) = 0)
    SET X = &X - 1
END

SET DSN = &SUBSTR(1:&X,&STR(&DSN))

GOTO START

HELPSEC: +
WRITE *** HELP FOR CLIST BLDG ***
WRITE
WRITE THE 'BLDG' CLIST ALLOWS THE USER TO CREATE GDG INDEXES IN
WRITE FOREGROUND.  IT ALSO ALLOWS YOU TO DO THE FUNCTION INTERACTIVELY
WRITE OR AS A CALLED FUNCTION FROM ANOTHER CLIST.  YOU CAN DO THE
WRITE FOLLOWING FUNCTIONS :
WRITE
WRITE BUILD AN INDEX WITH A SPECIFIED NUMBER OF ENTRIES
WRITE DELETE AN EXISTING INDEX
WRITE LIST INFORMATION ABOUT AN EXISTING INDEX
WRITE
WRITE YOU CAN ALSO SPECIFY TO DISPLAY THE IDCAMS MESSAGES ASSOCIATED
WRITE WITH ANY OF THE 3 ABOVE FUNCTIONS.
WRITE
WRITE BASIC SYNTAX :
WRITE
WRITE COMMAND ===> TSO BLDG
WRITE
WRITE THIS INVOCATION WILL BRING UP A PANEL WHERE YOU CAN ENTER
WRITE THE VALUES THAT CORRESPOND TO THE FUNCTION YOU WANT TO PERFORM.
WRITE
WRITE SYNTAX TO SPECIFY YOUR FUNCTION AND DATASET AT EXECUTION TIME :
WRITE
WRITE COMMAND ===> TSO BLDG DSN('') FUNC(L)
WRITE
WRITE THIS INVOCATION WILL LIST THE GDG INDEX INFORMATION FOR THE
WRITE DATASET SPECIFIED AND THEN RETURN CONTROL BACK TO THE SCREEN WHERE
WRITE BLDG WAS CALLED.
WRITE
WRITE THERE ARE DEFAULT PROCESSES IF YOU SPECIFY A DATASET NAME AT
WRITE EXECUTION TIME.  THE FOLLOWING IS AN EXAMPLE :
WRITE
WRITE COMMAND ===> TSO BLDG DSN('')
WRITE
WRITE THIS INVOCATION WILL BUILD A GDG INDEX WITH 3 ENTRIES FOR THE
WRITE DATASET NAMED.
WRITE
WRITE TO SEE THE IDCAMS MESSAGES REGARDING THE FUNCTION THE USER IS
WRITE PERFORMING, THE 'SYSPRINT' KEYWORD WOULD BE USED....I.E. :
WRITE
WRITE COMMAND ===> TSO BLDG DSN('') FUNC(D) SYSPRINT
WRITE
WRITE THIS INVOCATION WILL DELETE THE GDG INDEX FOR THE NAMED DATASET
WRITE AND SHOW YOU THE ASSOCIATED IDCAMS MESSAGES. IF SYSPRINT IS NOT
WRITE SPECIFIED, THE BLDG UTILITY WILL DISPLAY MESSAGES OF ITS OWN.
WRITE
WRITE *** END OF HELP *** NO PROCESSING PERFORMED
EXIT
            


Documentation

 This utility will allow you to build, delete, or list generation data group
 indexes interactively.  This is done via a panel where you enter the dataset
 index base name and other parameters.  Additionally, this utility can be
 invoked from another CLIST with passed parameters that will allow an SE to
 incorporate the bldg utility in other operations without having to go to the
 panel at each execution.
&nbsp;
 The keyword parameters available are FUNC (valid) values of B, D, and L for
 function, ENT for the number of entries when building a GDG, DSN to specify the
 GDG base name, and SYSPRINT to specify that the IDCAMS SYSPRINT is to be
 displayed on the terminal.  There are no positional parameters.  TOP SECRET
 controls what indexes you are able to build.
&nbsp;
 An example of calling BLDG from a CLIST would be as follows:
&nbsp;
 %BLDG DSN(dataset.name.with.no.quotes) FUNC(B) ENT(3)            


Leave a Reply

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