/* REXX */ /* */ /* AUTHOR: Mark Zelden */ /* */ /* Last Updated 10/07/2013 */ /* */ help_start = HELP_INCL() /**********************************************************/ /* This edit macro will include only lines that contain */ /* a specified search string. The search string can */ /* optionally be limited to specific columns. */ /* */ /* EXAMPLES: */ /* INCL ' JOB' */ /* INCL '//' 1 2 */ /* */ /* */ /* ** NOTE If you execute INCL with no parms or with */ /* a parm of "?", the comment section of this */ /* code with examples will be displayed as */ /* "help" note lines. Use the "RESET" */ /* command to remove them. */ /* */ /**********************************************************/ /* */ /* "HIDE EXCLUDED" is used on systems that are running */ /* z/OS 1.6 (ISPF 5.6) and above. */ /* Remove or comment out the following line of code */ /* around line 118 if you like to see excluded lines */ /* or issue the "RESET HIDE" command after you run */ /* the EXCL macro. */ /* */ /* If Substr(ZENVIR,6,3) >= 5.5 then "HIDE EXCLUDED" */ /* */ /**********************************************************/ help_end = HELP_INCL() /* Trace ?R */ Address ISREDIT "MACRO (parm col1 col2)" /* Address ISPEXEC "CONTROL ERRORS RETURN" */ If pos('&',parm) <> 0 then do parmx = Translate(parm) /* upper case */ parmx = C2X(parmx) /* change to hex for seek/find */ amp = 'Y' End If parm = '?' then do Call HELP_NOTELINES Exit 1 /* return cursor to command line */ End If parm = '' then do zedsmsg = 'NO SEARCH STRING' zedlmsg = 'YOU MUST PASS A SEARCH STRING PARM', 'TO INCL.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Call HELP_NOTELINES Exit 4 End /* check for numeric column numbers */ If col1 <> '' then do If Datatype(col1,Number) <> 1 then do zedsmsg = 'START COLUMN NOT NUMERIC' zedlmsg = 'THE STARTING COLUMN FOR THE', 'SEARCH MUST BE NUMERIC.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End If col2 = '' then col2 = col1 End If col2 <> '' then do If Datatype(col2,Number) <> 1 then do zedsmsg = 'END COLUMN NOT NUMERIC' zedlmsg = 'THE ENDING COLUMN FOR THE', 'SEARCH MUST BE NUMERIC.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End If col2 < col1 then do zedsmsg = 'END COL < START COL' zedlmsg = 'THE ENDING COLUMN MUST BE GREATER THAN OR', 'EQUAL TO THE STARTING COLUMN.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End If Length(Strip(Translate(parm,'','"'''''))) , > COL2-COL1+1 then do zedsmsg = 'PARM TOO LONG' zedlmsg = 'THE STRING WILL NOT FIT BETWEEN THE', 'SPECIFIED COLUMNS.' Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End "(width) = DATA_WIDTH " /* length of line */ width = Format(width) /* remove leading zeros */ If col1 < 1 | col2 < 1 | col1 > width | col2 > width then do zedsmsg = 'INVALID COLUMN NUMBER' zedlmsg = 'ALL COLUMN SPECIFICATIONS MUST BE' , 'BETWEEN 1 AND' width Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End End parmck = Translate(parm) If parmck = 'X' | parmck = 'NX' | parmck = '*' , | parmck = '/*' then parm = "'" ||parm|| "'" If AMP = 'Y' then "SEEK x'"parmx"'" col1 col2" FIRST" Else "SEEK "parm col1 col2" FIRST" If rc = 0 then do "EXCLUDE ALL" If AMP = 'Y' then do "FIND x'"parmx"'" col1 col2" ALL" "SEEK x'"parmx"'" col1 col2" ALL" End Else do "FIND "parm col1 col2" ALL" "SEEK "parm col1 col2" ALL" End "(count,lines) = SEEK_COUNTS" Address ISPEXEC "VGET ZENVIR" If Substr(ZENVIR,6,3) >= 5.5 then "HIDE EXCLUDED" count = Format(count) lines = Format(lines) parm = Translate(parm) /* upper case */ zedsmsg = count' "'parm'" FOUND' zedlmsg = 'THE STRING "'parm'" WAS FOUND 'count' TIMES', 'ON 'lines' LINES.' Address ISPEXEC "SETMSG MSG(ISRZ000)" /* msg - no alarm */ Exit 1 /* return cursor to command line */ End Else do parm = Translate(parm) /* upper case */ zedsmsg = 'STRING NOT FOUND' zedlmsg = 'THE STRING "'parm'" WAS NOT FOUND IN THE FILE.' "RESET" Address ISPEXEC "SETMSG MSG(ISRZ001)" /* msg - with alarm */ Exit 12 End /*********************************/ /* HELP SUB-ROUTINES */ /*********************************/ HELP_INCL: Return SIGL HELP_NOTELINES: "(helpln) = DISPLAY_LINES" Do hlp = help_end-1 to help_start+1 by -1 hline = Sourceline(hlp) "ISREDIT LINE_AFTER " helpln " = NOTELINE (hline)" End hline2 = '===================' hline3 = '=== H E L P ===' "ISREDIT LINE_AFTER " helpln " = NOTELINE (hline2)" "ISREDIT LINE_AFTER " helpln " = NOTELINE (hline3)" "ISREDIT LINE_AFTER " helpln " = NOTELINE (hline2)" Return