Mainframe Utility: FINDALL

Return to Mainframe Utilities Page

Module


ISREDIT MACRO (OPT1)
ISPEXEC CONTROL ERRORS RETURN
/**** 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
/***************************************************************************/
/*                                                                          */
/* 'FINDALL' EDIT MACRO. POSITION CURSOR ON DATA FIELD NAME AND EXECUTE     */
/* TO FIND ALL THE OCCURRANCES OF THE DATA FIELD DURING AN EDIT SESSION.    */
/*                                                                          */
/* AUTHOR : JEFF JONES     DATE : 10-22-89         SSEC                     */
/*                                                                          */
/* REWRITTEN BY DAVID LEIGH FOR EFFICIENCY                                  */
/***************************************************************************/

IF &OPT1 = &STR(HELP) THEN GOTO HELPSEC
/*                                                                          */

ISREDIT (LN,CL) = CURSOR
IF &CL = 0 THEN +
    DO
        SET ZEDLMSG = &STR(*** YOUR CURSOR MUST BE IN THE "BODY" OF +

                           THE DATA, NOT ON THE COMMAND LINE ***)
        ISPEXEC SETMSG MSG(UTLZ001)
        EXIT
    END

ISREDIT FIND PREV ' ' .ZCSR .ZCSR
ISREDIT FIND NEXT P'¬' .ZCSR .ZCSR
ISREDIT (LN1,CL1) = CURSOR
ISREDIT FIND NEXT ' ' .ZCSR .ZCSR
ISREDIT FIND PREV P'¬' .ZCSR .ZCSR
ISREDIT (LN2,CL2) = CURSOR
ISREDIT (DATA) = LINE .ZCSR

IF &CL1 > &CL2 OR +
   &SUBSTR(&CL:&CL,&STR(&SYSNSUB(1,&DATA))) = &STR( ) THEN +
    DO
        SET ZEDLMSG = &STR(*** YOUR CURSOR MUST BE ON A NON-BLANK +
                           STRING. ***)
        ISPEXEC SETMSG MSG(UTLZ001)
        ISREDIT CURSOR = &LN &CL
        EXIT
    END

SET STG = &SUBSTR(&CL1:&CL2,&STR(&SYSNSUB(1,&DATA)))

IF &OPT1 = &STR(KEEP) THEN GOTO FINDALL
ISREDIT EXCLUDE ALL
FINDALL: +
ISREDIT FIND ALL '&STR(&SYSNSUB(1,&STG))'

EXIT

HELPSEC: +
WRITE
WRITE         *** HELP FOR EDIT MACRO 'FINDALL' ***
WRITE
WRITE THE FINDALL MACRO IS AN EDIT MACRO WHICH IS EXECUTABLE FROM A
WRITE NORMAL EDIT SESSION.  THE MACRO WORKS IN ANY EDIT SESSION WITH
WRITE ANY TYPE OF PROGRAM OR DATASET, AS LONG AS IT CAN BE EDITED.
WRITE
WRITE THE FINDALL MACRO WILL ENABLE A USER TO PLACE THE CURSOR
WRITE ANYWHERE ON A FIELD IN AN EDIT SESSION AND PRESS A PF KEY TO
WRITE FIND ALL OCCURRENCES OF THE FIELD IN THE DATASET OR MEMBER BEING
WRITE EDITED.  IT DOESN'T MATTER WHERE ON THE FIELD THE CURSOR IS
WRITE PLACED.  THE MACRO WILL ISOLATE THE SPACE DELIMITED STRING THE
WRITE CURSOR IS ON.
WRITE
WRITE FOR EXAMPLE:  THE CURSOR MAY BE PLACED ON THE "L" IN THE FIELD
WRITE "L-YEAR", OR ON THE 'E', OR 'R'.  IT COULD BE PLACED ANYWHERE ON
WRITE THE "C-80" FIELD.  ONCE THE PF KEY IS PRESSED, THE CURSOR WILL
WRITE BE POSITIONED ON THE FIRST OCCURRENCE OF "L-YEAR" OR "C-80" AND
WRITE ALL LINES NOT CONTAINING THE STRING WILL BE "EXCLUDED".
WRITE
WRITE      MOVE L-YEAR  TO W-YEAR-2ND.
WRITE      IF L-YEAR < C-80
WRITE         MOVE C-20 TO W-YEAR-1ST.
WRITE
WRITE IF THE CURSOR IS PLACED ON A SPACE, AN ERROR MESSAGE WILL BE
WRITE DISPLAYED ON THE TOP LINE OF THE SCREEN.
WRITE
WRITE         *** END OF HELP *** NO PROCESSING PERFORMED ***

EXIT
            


Documentation

 This utility allows you to place your cursor on any non-blank string in an edit
 session.  The utility will then determine the beginning and ending of the
 string (as delimited by ' ', '=', ',', or '.').  Once it has the string, it
 will do a &quot;find all&quot; of the string.            


Leave a Reply

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