Mainframe Utility: FINDMOD

Return to Mainframe Utilities Page

Module


/**********************************************************************
/* UTILITY : FINDMOD                                                  *
/* AUTHOR  : DAVID LEIGH                                              *
/* FUNCTION : SEARCH A GIVEN ALLOCATED DDNAME CONCATENATION FOR THE   *
/*            FIRST OCCURANCE OF THE PASSED MEMBER NAME.              *
/************************* MODIFICATIONS ******************************
/* WHO          WHEN      WHAT AND WHY                                *
/* ===========  ========  =========================================== *
/* DAVID LEIGH  09/18/90  INITIAL CREATION OF THE UTILITY             *
/**********************************************************************
PROC 2 MEMBER_TO_FIND DDNAME_TO_SEARCH UTILITY(FINDMOD) +
       EDIT BROWSE DEBUG BATCH
IF &DEBBG = DEBUG THEN  +
     CONTROL MSG LIST CONLIST SYMLIST NOFLUSH
ELSE CONTROL NOMSG NOLIST NOFLUSH NOPROMPT
IF &MEMBER_TO_FIND = HELP THEN GOTO HELPSEC
/**********************************************************************
/* LET THE USER KNOW WHAT THE HECK IS HAPPENING                       *
/**********************************************************************
SET ZEDLMSG = &STR(SEARCHING FOR "&MEMBER_TO_FIND" IN THE +
                   "&DDNAME_TO_SEARCH" DD CONCATENATION)

IF &BATCH ¬= BATCH THEN +
    IF &SYSISPF = ACTIVE THEN +
        DO
            ISPEXEC CONTROL DISPLAY LOCK
            ISPEXEC DISPLAY PANEL(MSGPANEL)
        END
    ELSE +
        WRITE &STR(&ZEDLMSG)

/**********************************************************************
/* FIND THAT MEMBER!                                                  *
/**********************************************************************
SET ZEDLMSG =
SET SPACE = &STR(                                                    )
SET SYSOUTTRAP = 500
LISTA ST
DO &I = 3 TO &SYSOUTLINE
    SET CURRLINE = &&SYSOUTLINE&I
    SET H = &I - 1
    SET PREVLINE = &&SYSOUTLINE&H
    SET J = &I + 1
    SET NEXTLINE = &&SYSOUTLINE&J
    SET PREVLINE = &STR(&PREVLINE&SPACE)
    SET CURRLINE = &STR(&CURRLINE&SPACE)
    SET NEXTLINE = &STR(&NEXTLINE&SPACE)
    SELECT
        WHEN (&SUBSTR(3:10,&STR(&CURRLINE)) = &DDNAME_TO_SEARCH AND +
              &SUBSTR(1:2,&STR(&CURRLINE)) = &STR(       )) +
             DO
                 SET DSNAME = &PREVLINE
                 SET SWITCH = ON
             END
        WHEN (&SUBSTR(1:10,&STR(&CURRLINE)) = &STR(               )) +
             SET DSNAME =
        WHEN (&SUBSTR(3:10,&STR(&NEXTLINE)) > &STR(        ) AND +
              &SUBSTR(1:2,&STR(&NEXTLINE)) = &STR(  ) AND +
              &STR(&SWITCH) = ON) +
             DO
                 SET DSNAME =
                 SET I = &SYSOUTLINE + 1
             END
        WHEN (&STR(&SWITCH) ¬= &STR(ON)) SET DSNAME =
        OTHERWISE SET DSNAME = &CURRLINE
    END
    IF &STR(&DSNAME) >    THEN +
        IF &SYSDSN('&DSNAME(&MEMBER_TO_FIND)') = OK THEN +
            IF &BATCH = BATCH THEN +
                DO
                    SET DSN = &STR(&DSNAME(&MEMBER_TO_FIND))
                    ISPEXEC VPUT DSN SHARED
                    SET SYSOUTTRAP = 0
                    EXIT CODE(0)
                END
            ELSE +

                DO
                    SET I = &SYSOUTLINE + 1
                    SET ZEDLMSG = &STR(*** "&MEMBER_TO_FIND" IS IN +
                                       "&DSNAME" IN DD : +
                                       "&DDNAME_TO_SEARCH" ***)
                    IF &SYSISPF = ACTIVE THEN +
                        ISPEXEC SETMSG MSG(UTLZ000)
                    ELSE +
                        WRITE &STR(&ZEDLMSG)
                END
END
SET SYSOUTTRAP = 0

IF &STR(&ZEDLMSG) =     THEN +
    DO
        IF &BATCH = BATCH THEN EXIT CODE(8)
        ELSE +
            DO
                SET ZEDLMSG = &STR(*** "&MEMBER_TO_FIND" NOT FOUND IN +
                                   DD : "&DDNAME_TO_SEARCH" ***)
                IF &SYSISPF = ACTIVE THEN +
                    ISPEXEC SETMSG MSG(UTLZ001)
                ELSE +
                    WRITE &STR(&ZEDLMSG)
            END
    END
ELSE +
    DO
        IF &EDIT = EDIT THEN +
            IF &SYSISPF = ACTIVE THEN +
                ISPEXEC EDIT DATASET('&DSNAME(&MEMBER_TO_FIND)')
            ELSE +
                DO
                    PDS   '&DSNAME'
                    EDIT &MEMBER_TO_FIND
                END
        IF &LASTCC = 20 OR &BROWSE = BROWSE THEN +
            IF &SYSISPF = ACTIVE THEN +
                DO
                    ISPEXEC BROWSE DATASET('&DSNAME(&MEMBER_TO_FIND)')
                    IF &LASTCC = 20 THEN +
                        DO
                            SET ZEDLMSG = &STR(*** COULD NOT ACCESS +
                                  "&MEMBER_TO_FIND" IN "&DSNAME" ***)
                            ISPEXEC SETMSG MSG(UTLZ001)
                        END
                END
            ELSE +
                DO
                    PDS   '&DSNAME'
                    BROWSE &MEMBER_TO_FIND
                END
    END

EXIT

HELPSEC: +
WRITE *** HELP FOR CLIST "FINDMOD" ***
WRITE
WRITE "FINDMOD" WILL SEARCH A GIVEN DDNAME (LIKE "SYSPROC" OR
WRITE "ISPPLIB") WHICH IS ACTUALLY A CONCATENATION OF SEVERAL PDS'S
WRITE AND TELL YOU WHERE A SPECIFIC MEMBER IN THAT CONCATENATION IS
WRITE FOUND FIRST.  YOU MAY INVOKE "FINDMOD" BY TYPING "TSO FINDMOD
WRITE XXXXXXXX YYYYYYYY" WHERE "XXXXXXXX" IS THE MEMBER YOU WISH TO
WRITE FIND AND "YYYYYYYY" IS THE DDNAME YOU WISH TO SEARCH.  IF YOU
WRITE ARE NOT IN "ISPF" YOU CAN INVOKE THIS CLIST WITH THE SAME SYNTAX
WRITE EXCEPT FOR THE "TSO" (E.G.  "FINDMOD XYZCLIST SYSPROC").
WRITE
WRITE *** END OF HELP *** NO PROCESSING PERFORMED ***
EXIT
            


Documentation


            


Leave a Reply

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