/**rexx************************************************************** NXNX Author: David McRitchie, created 1987/04/17 IS03 at "The REXX Macros Toolbox" updated 1990/11/13 09:38 IS03 updated 1992/03/09 16:30 IS03 line 97 continuation split REXX 1993/05/20 16:05 IS03 converted to REXX ******************************************************************* Title: NXNX, make line before/after NX line also visible Users: TSO ISPF edit users or Script users Contributed: 1987/04/17 David McRitchie Author: David McRitchie, "The REXX Macros Toolbox" 1987/04/17 This clist is universally available with the stipulation that that the original author remains credited and that no charge or licensing fee accrues to any party. EXAMPLE: NXNX .FIRST .ZLAST AFTER(1) --DEFAULTS NXNX .A .B BEFORE(N) NXNX .A .B AFTER(N) NXNX .A .B BEFORE(N) AFTER(X) NXNX .A .B LABEL || The only defaults NXNX .A .B CHG || Are .ZF .ZL NXNX .A .B ERR || NXNX .A .B SPECIAL || AFTER(1) will NXNX .A .B XLABEL || Default only if || No other parms NXNX .A .B FLIP -- same as FLIP primary command which is available in TSO Documented: IS03.SHARE.TEXT(NXNX) OPTIONS: LABEL RANGE AFTER(NN), Display nn lines after, AFTER may be used in place of AFTER(1) BEFORE(NN), Display nn lines before, BEFORE may be used in place of BEFORE(1) LABEL, Make LABEL lines visible (any level) CHG, Make CHG lines visible ERR, Make ERR lines visible SPECIAL, Make special lines visible STR(xxx), Make visible only if line contains the string xxx XLABEL, Make label lines not visible (any level) FLIP, X lines become NX and vice versa (FLIP in TSO) USAGE: X ALL \ F '.PA ' ALL \ NXNX BEFORE(3) AFTER(3) ================================================================ **/ /*********************************************************************/ address 'ISREDIT'; 'MACRO (PARMS) NOPROCESS'; note = 'LINE_BEFORE .zfirst = NOTELINE ' xstrx=''; after=0; Before=0; Change='';chg=''; Err=''; Error=''; Lab=''; label=''; Labf=''; Labl=''; Remainder=''; Special=''; xlabel=''; Zedlmsg='' Zedsmsg=''; Spe=''; Flip=''; /* Collect Parameters */ if parms = '' Then do; /* *No parameters -- Default to a test* */ zedsmsg = '' zedlmsg = "NXNX missing operands such as", "AFTER(N) BEFORE(N) CHG CHANGE ERR ERROR LAB LABEL ", "SPE SPECIAL XLABEL" Address "ISPEXEC" "SETMSG MSG(ISRZ000)" exit 8 end parms = translate(parms) parse var parms left 'STR(' xstrx ')' right parms = left right do iii = 1 to 10; token = word(parms,iii) if token = '' Then leave tokenx = translate(token); j = pos(tokenx,' AFTER BEFORE CHG CHANGE ERR ERROR LAB LABEL ', ||'SPE SPECIAL XLABEL FLIP ') if j <> 0 then do; string = token ' = '''token'''' interpret string iterate iii end; if substr(token,1,6) = 'AFTER(' then do; parse var token 'AFTER(' after ')' Right; iterate iii; end if 'BEFORE(' = Substr(token,1,7) then do; parse var token 'BEFORE(' before ')' Right; iterate iii; end if substr(token,1,1) = '.' Then do if labf = '' Then labf = token else if labl = '' Then labl = token else do zedsmsg = '.LABEL RC=8' zedlmsg = 'too many labels --' Labf labl token Address "ISPEXEC" "SETMSG MSG(ISRZ000)" exit 8 end iterate iii end remainder = remainder token end iii if remainder <> "" Then do zedsmsg = Remainder zedlmsg = remainder "-- Parameters unknown to NXNX" Address "ISPEXEC" "SETMSG MSG(ISRZ000)" Exit 8 end if labl = '' Then do "PROCESS RANGE C" if RC = 0 THEN DO "LABEL .zfrange = .labf 1" "LABEL .zlrange = .labl 1" labf = ".labf" LABL = ".labl" end end if labl = '' Then do; labf='.ZFIRST'; labl='.ZLAST'; end; if after = "AFTER" then after=1 if before = "BEFORE" then before=1 if xstrx \= '' then if after=0 then if before=0 then after=1 if xlabel = "XLABEL" then do;"x 1 p'=' all" Labf labl;label="LABEL"; end "(LABFNO) = LINENUM" LABF "(LABLNO) = LINENUM" LABL if chg <> '' | Change <> '' then change = 'CHANGE' if err <> '' | Error <> '' then error = 'ERROR' if spe <> '' | Special <> '' Then special = 'SPECIAL' if lab <> '' | Label <> '' Then label = 'LABEL' if label="LABEL" then do i = labfno to lablno "(var1,var2) = LABEL " i;if rc = 0 then "XSTATUS" i "= NX" end if change="CHANGE" then do "loc 0"; "cursor = " Labfno 0;rc=0 do while rc=0; /* Continues on for all occurences to .ZLAST*/ "locate next change"; end end if error="ERROR" then do "loc 0"; "cursor = " Labfno 0;rc=0 do while rc=0; /* Continues on for all occurences to .ZLAST*/ "locate next error"; end end if special = "SPECIAL" then do "CURSOR = " Labfno 0 "CURSOR = " Value(labfno -1) 0 do while rc = 0;"LOCATE NEXT SPECIAL";end end if labfno = 0 then do; say 'set to 1'; labfno=1; end; if before <> '' Then do i = labfno to lablno "(VAR075) = XSTATUS" i if VAR075 = "NX" then do if labfno = 0 then iterate lower = i - before; if lower < labfno then lower=labfno upper = i - 1; if upper < labfno then upper = labfno do k = lower to upper; "CURSOR =" i 0 if xstrx ="" then "XSTATUS" k "= NX"; else do; /* special code if xstrx(xxx) in use */ address "ISREDIT" "LABEL" k "= .KPTR 0" "CURSOR =" k 0 address "ISREDIT" "Find .KPTR .KPTR" xstrx end; end end end if flip <> '' Then do i = labfno to lablno "(VAR075) = XSTATUS" i if VAR075 = "NX" then "XSTATUS" i "= X" else "XSTATUS" i "= NX" end if after <> '' Then do i = lablno to labfno by -1 "(VAR075) = XSTATUS" i if VAR075 = "NX" then do upper = i + after; if upper > lablno then upper = lablno lower = i + 1;if upper > lablno then upper = lablno do k = lower to upper; if xstrx ="" then "XSTATUS" k "= NX"; else do; /* special code if xstrx(xxx) in use */ address "ISREDIT" "LABEL" k "= .KPTR 0" "CURSOR =" k 0 address "ISREDIT" "Find .KPTR .KPTR" xstrx end; end end end if flip = "" then "(linex,colx) = Cursor"; zedsmsg = 'Completed' zedlmsg = "NXNX" parms "-- Completed" Address "ISPEXEC" "SETMSG MSG(ISRZ000)"