Address "ISREDIT";"MACRO (parms) NOPROCESS" /* David McRitchie -- "The REXX Macros Toolbox" -- 1997/06/25 */ /* http://www.geocities.com/davemcritchie/ */ /* REMOVAL: */ /* This macro is designed to remove the delimiters and all */ /* characters in between. A delimiter must appear intact on */ /* a line, but both delimiters do not need to be on the same */ /* line. A check will be made to make sure that delimiters */ /* are in fact paired up. Nesting or overlapping not checked. */ /* You could use this to remove HTML coding between < ... > */ /* delimiters of "<" and ">". It will leave blank lines and */ /* it will leave escape characters   " etc. */ /* Was created for the possible removal of [-- --] */ /* that gets created by HTMLDOC. */ /* c all '--]
' '--]
' */ /* REMOVAL < > */ /* */ /* USE OF THIS MACRO IS FOR USE OF LAST RESORT: */ /* USE OF THIS MACRO IS VERY RISKY: Make sure you run a comparison */ /* of what you had before with the results. NOTELINES have been */ /* generated to help you see what gets deleted. */ /* REMOVAL HTML -- remove HTML < ... > coded portions */ /* REMOVAL HTMLDOC -- remove portions changed by HTMLDOC */ /* REMOVAL ADD_DATE -- remove portions ADD_DATE upto > but not incl. */ /* REMOVAL WIDTH= dlm -- remove to next blank or other delimiter */ /* REMOVAL -- remove font specifications */ /* REMOVAL -- remove /font specifications */ /* similar but not same as change all "" "" -- due to spaces*/ /*********************************************************************/ labf=""; labl=""; nxprm = ""; lablno = 000000; labfno = 000000 rcs="" parms = " "translate(parms)" " i = pos(" NX ",parms) if i \= 0 then do; nxprm = "NX"; parms = left(parms,i)||, substr(parms,I+4); end i = pos(" .",parms) if i \= 0 then do; parse var parms left "." labf " " mid "." labl " " remain parms = left mid remain if labl = "" then do "@msg unpaired labels"; exit end labf = "."labf; labl = "."labl "(LABFNO) = LINENUM" LABF "(LABLNO) = LINENUM" LABL if labfno = 0 | lablno = 0 then do "@MSG" "label" labf 'and/or' labl 'missing' "@NOTE label" labf 'and/or' labl 'missing' exit 4 end end if lablno = 000000 then do "PROCESS RANGE C" rcs = rc if RC = 0 THEN DO "(labfno) = linenum" .zfrange "(lablno) = linenum" .zlrange end if labfno = 0 then "(labfno) = linenum .zfirst" if lablno = 0 then "(lablno) = linenum .zlast" end jab = labfno '-------------------' lablno 'rc='rcs "line_before .zf = noteline (jab)" parse var parms arg1 arg2 . if '"' = left(arg1,1) then do parse var parms """" arg1 """" """" arg2 """" end else if "'" = left(arg1,1) then do parse var parms '''' arg1 '''' '''' arg2 '''' end line = arg1 "-- " arg2 if arg1 = "HTML" then do; arg1 = "<"; arg2=">"; end; else if arg1 = "HTMLDOC" then do; "c all '
' '
'" arg1 = "
[--" arg2 = "--]" end else if arg1 = "ADD_DATE" then do; arg1 = " ADD_DATE="; arg2=">"; end; "line_before .zfirst = noteline (line)" newline = "aaa"; currline=""; drop=""; l1 = length(arg1) l2 = length(arg2) if arg1 = "" | arg2 = "" then do "@msg" "Missing delimiter(s) --" arg1 "--" arg2 "@note" "Missing delimiter(s) --" arg1 "--" arg2 exit 12 end /* now attempt to make everything work with SPF/PC attitude */ /* problem (removal of labels). */ "line_after" lablno "= dataline ""___en_d REMOVAL""" "line_before" labfno "= dataline ""___be_g REMOVAL""" lablno = lablno + 2 "label" labfno "= .RMVLF 0" "label" lablno "= .RMVLL 0" nxparm = nxprm ".RMVLF .RMVLL " /* group of parmeters */ "seek" nxparm "all '"arg1"'" "(c1a,c1b) = seek_counts" "seek" nxparm "all '"arg2"'" "(c2a,c2b) = seek_counts" if arg1 = " ADD_DATE=" then signal contin if arg2 = "DLM" then signal contin if arg2 = ">" then signal contin if c1a \= c2a then do "@MSG" "unpaired delimiters, counts do not match" c1a c2a "@NOTE" "unpaired delimiters, counts do not match" c1a c2a call alldone(1) end contin: "cursor = 1 0" lastmsg = "" loop: "find" nxparm "next '"arg1"'" if rc \= 0 then call alldone "(row1,col1) = cursor" "(currline) = line" row1 "cursor =" row1 col1 row1 = row1 + 0 if arg2 = "DLM" then do currline = currline" " /* guarantee delimiter */ /* must be contained all on one line */ i=verify(currline,"0123456789""ABCDEFGHIJKLMNOPQRSTUVWXYZ", ||"abcdefghijklmnopqrstuvwxyz",,col1+length(arg1)) /* if delimiter on right matches left side, include only one*/ x1a = substr(currline,i,1); x1b=substr(currline,(col1-1),1) say x1a","x1b","currline if x1a == x1b | x1a == ">" & x1b == " " then newline = substr(currline,1,col1-2)||substr(currline,i) else newline = substr(currline,1,col1-1)||substr(currline,i) drop = substr(currline,col1,i-col1) "<-- drop" "line_before .zcsr = noteline (drop)" "line_before" row1 " = noteline (currline)" "line" row1 " = (newline)" col2 = i "cursor =" row1 col2 signal loop end; "find" nxparm "next '"arg2"'" if rc \= 0 then call alldone "(row2,col2) = cursor" if arg1 = " ADD_DATE=" then col2 = col2 - 1 if row1 = row2 then do if row1 \= lastmsg then do "(currline) = line" row1 "line_before" row1 " = noteline (currline)" lastmsg = row1 end "(line) = line" row1 newline = substr(line,1,col1-1)||substr(line,col2+l2) if " " = substr(line,col1-1,1) then if ">" = substr(line,col2+l2,1) then newline = substr(line,1,col1-1)||substr(line,col2+l2) drop = substr(line,col1,col2+l2-col1) "<- DROP" "line_before .zcsr = noteline (drop)" "line" row1 " = (newline)" col2 = col2 + l2 - 1 - length(drop) "cursor =" row1 col2 signal loop end /* not doing a real check so row2 can only be > row1 */ drop =substr(line,col1) "<-Dropped" newline = substr(line,1,col1-1) "line_before .zcsr = noteline (drop)" "line" row1 " = (newline)" row1 = row1 + 1 reloop: "(currline) = line" row1 if row1 < row2 then do drop = line "line_before .zcsr = noteline (drop)" "line" row1 " = "" """ col1 = 0; row1 = row1 + 1 "cursor =" row1 col1 signal reloop end drop = substr(currline,1,col2-1) newline = substr(currline,col2+l2) "line_before .zcsr = noteline (drop)" "line" row1 "= (newline)" col2 = col2 + l2 - 1 "cursor =" row2 col2 "line_before" row2 "= noteline ""----------------------""" signal loop alldone: "del .RMVLF .RMVLF all" "del .RMVLL .RMVLL all" exit