/* FIXREXX: fix REXX code to standard used on system working with */ /* F.David McRitchie -- "The REXX Macros Toolbox" created 1993/06/09*/ /* OS2, parameter will indicate changes are to be made for REXXSAA*/ /* even though actually running under MVS, allowing member to*/ /* be put into proper form before copying over later to OS/2 */ /* OS/2 version maintained in IS03.SPF2.MACROS gets installed */ /* in c:\spfmacro\fixrexx.spf */ /* TSO version maintained in IS03.LIRB.CLIST gets copied to */ /* SYS1.TSOCLIST(FIXREXX) */ /* ==== this macro should work unchanged on TSO and on PC ======= */ address "ISREDIT";"MACRO (TOKEN)" "(MEMBERX) = MEMBER " "(DSNX) = DATASET" startup = time('e') memberx = translate(memberx) if x2c('c1') = "A" then ASCII=0; else ASCII=1 if ASCII = 1 then call note 'Running PC side with ASCII characters' Parse version V1 V2 V3 V4 V5 memberx = translate(memberx) token = translate(token) /* make uppercase like translate*/ if token = "" then if dsnx = "IS03.SPF2.MACROS" then token="OS/2" if token = "OS2" then token = "OS/2" call note "token="token', v1='v1',' time('n')',' time('e') allowchg = 1 i= pos('FIX',memberx) /*do not do unto thyself*/ if i \= 0 then allowchg=0 /* do not apply changes on thyself*/ "x all 1 p'='" "find 'ISPEXEC' word all" if allowchg = 1 then do /* v1x used below because no longer a problem */ if v1= "REXXSAA" | v1="REXX/2" | token = "OS/2" then "change all nx ' Address ' ' /*Address*/ '" /* still check on MVS side for OS/2 macros brought over */ else if v1 = "REXX370" then "change all nx '/*Address*/' 'Address'" end /*===================================================================*/ if v1= "REXXSAA" | v1="REXX/2" | token = "OS/2" then do /* OS/2 only-*/ "Find all 'SYSVAR(SYSICMD)'" call processorN ' --check change "SYSVAR(SYSICMD)" '''memberx'''' "Find all 'SYSVAR(SYSICMD)'" call processor ' SYSVAR(SYSICMD) does not exist on PC use' memberx if allowchg = 1 then do "change all 'SYSVAR(SYSICMD)' '"memberx"' " end "Find all 'SYSDSN('" call processor ' use x=STREAM(myfile,''c'',''query exits'') on PC' if allowchg = 1 then do "change all word c'isredit' 'ISREDIT'" call processorW 'word isredit should be capitalized in SPF/2' "change all word c'noprocess' 'NOPROCESS'" call processorW 'word noprocess should be capitalized in SPF/2' "change all word c'process' 'PROCESS'" call processorW 'word process should be capitalized in SPF/2' /* words must be capitalized C ISPEXEC ISREDIT NOPROCESS PROCESS */ /* capitalized for comparison NB Q QQ */ end if token \= "OS/2" then do /* running SPF/PC */ "Find all x'AA3D' " /*incorrect conversion to OS/2*/ call processor ' not equal aa3d converted to not equal 5c3d ' "change all x'AA3D' x'5C3D'" /* µ=, not equal */ "change all x'b53d' x'5C3D'" /* µ=, not equal */ "find all x'AA' " /* 5F incorrect conversion to AA ASCII*/ call processor, 'OS/2 not must be a caret x''5E''=µ, not an x''AA''=^' end else do /* ^(5F) µ(B0) µ=(5f7E) µ=(B07E) in EBCDIC*/ /* OS/2 option in use -- use SPF/PC requirements*/ "line_before .zfirst = noteline", "'OS/2 option treatment as if for SPF/PC'" "Find all x'b07e' " /*incorrect conversion to OS/2*/ call processor ' not equal aa3d converted to not equal 5c3d ' if ascii = 1 then do /*x'c1' is not 'A' */ "change all x'aa3d' x'b03d'" /* ^ = --> \= */ "change all x'5e3d' x'b03d'" /* µ = --> \= */ "change all x'7027aa' x'70275e'" /* p 'µ --> p'µ */ "find all x'AA'" /* 5F incorrect conversion to AA ASCII*/ call processor, 'OS/2 not must be a caret xx''B0''=µ, not an x''5F''=^' end else do /* on EBCDIC side with OS/2 requirements */ "change all x'5f7e' x'b07e'" /* ^ = --> \= */ "change all x'b07e' x'b07e'" /* µ = --> \= */ "change all x'977d5f' x'977db0'" /* p 'µ --> p 'µ */ "find all x'5F'" /* 5F incorrect conversion to AA ASCII*/ call processor, 'OS/2 requires a caret EBCDIC(x''b0''), ASCII(x''5E'')' end /************** "find all c'msg(isrz000)' " call processor 'MSG should be capitalized in SPF/2' ****************/ "find all word c'ISPEXEC'" call processorW 'word ISPEXEC should be capitalized in SPF/2' "find all word c'isredit'" call processorW 'word isredit should be capitalized in SPF/2' "find all word c'noprocess'" call processorW 'word noprocess should be capitalized in SPF/2' "find all word c'process'" call processorW 'word process should be capitalized in SPF/2' end end /*===================================================================*/ /* check this out µ= for not equal */ if v1 = "REXX370" then if token \= "OS/2" then do /*** TSO only ***/ /********************* "find all word c'msg(isrz000)'" call processorW ' TSO requires capitalization ' "change all c'msg(isrz000)' 'MSG(isrz000)'" ********************/ call processorW 'TSO requires capitialization' "change all word c'ISPEXEC' 'ISPEXEC'" call processorW 'word ISPEXEC should be capitalized in TSO' "find all x'B0'" /* from OS/2 to TSO caret not a not sign*/ call processor, 'TSO must be a not x''5F''=^, not caret x''B0''=µ' "find all 'stream('" call processor ' stream() not for TSO, perhaps SYSDSN(..)' end if v1 = "REXX370" then if token \= "OS/2" then do /*** TSO only ***/ "Find all 'CHARIN('" call processor ' CHARIN(... I/O function not available in TSO' "Find all 'CHAROUT('" call processor ' CHAROUT(... I/O function not available in TSO' "Find all 'CHARS('" call processor ' CHARS(... I/O function not available in TSO' "Find all 'LINEIN('" call processor ' LINEIN(... I/O function not available in TSO' "Find all 'LINEOUT('" call processor ' LINEOUT(... I/O function not available in TSO' "Find all 'LINES('" call processor ' LINES(... I/O function not available in TSO' "Find all 'STREAM('" call processor ' STREAM(... I/O function not available in TSO' end "find first .zfirst .zlast ' ""ISREDIT""'" if rc = 0 then "line_after .zf = Noteline ""PSF/2 appears not to like", "extra space between ADDRESS and ""ISREDIT"" " "seek first .zfirst .zfirst 1 '/"||"*'" if rc \= 0 then "line_after", ".zf = Noteline ""/"||"* comment must begin col1 in OS/2""" "find all '= '" /* OS/2 REXX wants null to be assigned*/ call processor, 'OS/2 REXX does not like missing string, use null string' "find all '=;'" /* ... as in P.='';X=''; */ call processor, 'OS/2 REXX does not like missing string, use null string' "find all 'range' word" /* ... as in PROCESS RANGE C */ call processorW 'PROCESS RANGE return code < 8 in tso, <= 8 is spf/pc' address "ISREDIT" /* i = index('abcd','bc') */ "find all p'index$' " /* OS/2 will not allow check for "index(" */ call processor 'Use POS() instead of INDEX -- reverse parameters' "find all ' ""ISREDIT '" "find all ' ""ISREDIT "" '" /* will not work on OS/2 with address*/ "find all ') = LABEL '" /* RC=4 not found, reports as RC=0 SP/2*/ call processor 'RC=4 not found, in SPF/2 incorrectly returns RC=0' "find all ""x all ' '""" /* Takes forever on OS/2*/ call processor "Use ""x all p'=' 1"" instead of"||, " ""x all ' '"" for efficiency" "find all ""x ' ' all""" /* Takes forever on OS/2*/ call processor "Use ""x all p'=' 1"" instead of"||, " ""x all ' '"" for efficiency" slasheq = '/'||'=';"find all slasheq " /* self change warning*/ call processor 'Use backslash equal for not equal, instead of \= ' "change all" slasheq "'\=' x" /* self change warning*/ find all '=noteline ' call processor 'SPF/PC requires space between = and noteline' "change all '= noteline (' '= noteline ('" "find word 'SET' all" call processorW 'SET may be left over from clist language' "find word '&&&&LASTCC' all" /* yes this is correct even in REXX*/ call processorW 'LASTCC may be left over from clist language' "find word 'WRITE' all" call processorW 'WRITE may be left over from clist language' "find word 'exit code' all" call processorW 'EXIT CODE(xx) may be left over from clist language' "find ' code(' all" call processor 'EXIT CODE(xx) may be left over from clist language' "find ' &&&&@' all" call processor 'REXX generally needs 4 ampersands (&&&&)' "find goto word all" /*should be signal not goto*/ call processorW 'GOTO is invalid in REXX, use SIGNAL instead' "find all '@'" call processor '@ # $ are not letters in OS/2' "find all '#'" call processor '@ # $ are not letters in OS/2' "find all '$'" "x all "" p'"" " "x all '$EDIT' " "find first '$' nx" call processor '@ # $ are not letters in OS/2' "find x all p'.'" call processor "WARNING -- invalid ASCII/EBCDIC values P'.' found" "find all TFLOW word" call processorW "loss of labels in SPF/PC with FLOW", "find all VPUT word" call processorW "VPUT/VGET limited in OS/2 MACRO to ZPFnn", ||"--consider queue|PUSH, POP in OS/2" "find all VPUT word" call processorW "VPUT/VGET restriction lifted in SPF/PC v.4" "find all VGET word" call processorW "VPUT/VGET limited in OS/2 MACRO to ZPFnn", ||"--consider queue|PUSH, POP in OS/2" "find all VGET word" call processorW "VPUT/VGET restriction lifted in SPF/PC v.4" "find all TSPLIT word" call processorW "TSPLIT is not handled properly in SPF/PC macros" "find all CURSOR word" call processorW "CURSOR location may be messed up by SPF/PC with Line_ operations" "find all CURSOR word" call processorW ".ZCSR location may be messed up by SPF/PC with Line_ operations" "find all dataid word" call processorW "DATAID not available in SPF/PC for REXX/2" call note "FIXREXX ended," time('n')', duration '||, value(time('e')-startup) 'seconds' exit 0 note: /* this call probably no longer used*/ parse arg arg "LINE_BEFORE .ZFIRST = noteline (arg)" return process: /* this call probably no longer used*/ if rc \= 0 then return parse arg arg;arg= '--' arg "LINE_AFTER .ZCSR = noteline (arg)" return processor: if rc \= 0 then return parse arg arg;arg= '--' arg "LINE_AFTER .ZCSR = noteline (arg)" do forever "find next * nx" if rc <> 0 then return "LINE_AFTER .ZCSR = noteline (arg)" end return processorN: if rc \= 0 then return "(LINE) = line .zcsr" "LINE_BEFORE .ZCSR = noteline (line)" parse arg arg;arg= '--' arg "LINE_AFTER .ZCSR = noteline (arg)" do forever "find next * nx" if rc <> 0 then return "(LINE) = line .zcsr" "LINE_BEFORE .ZCSR = noteline (line)" "LINE_AFTER .ZCSR = noteline (arg)" end return processorW: if rc \= 0 then return parse arg arg;arg= '--' arg "LINE_AFTER .ZCSR = noteline (arg)" do forever "find next * word nx" if rc <> 0 then return "LINE_AFTER .ZCSR = noteline (arg)" end return /****************** SPF/2 2.0 Are the following items fixed in SPF/PC Release 3.0 ? --1-- According to SC34-4253-01 "ISPF/PDF Edit and Edit Macros" V3.R3 MVS Chapter 6 Creating Edit Macros page 75, in INDEX -- ISPEXEC 75 Address ISPEXEC is supposed to prefix all SETMSG VPUT DISPLAY EDIT and LMINIT statements Although not mentioned to avoid other errors ISPEXEC should be enclosed in quotes to avoid possiblity that ISPEXEC is used as a variable. In SPF/2 the address is not permitted in front of ISPEXEC. **** Converting from MVS TSO the following are not supported in standard REXX. Problem relates to REXX difference not SPF/2. INDEX(haystack,needle) --change to--> POS(needle,haystack) --2-- Can not do FIND 'index(' with SPF2 and macro in REXX Had to change it to FIND p'index$' to sort of get it to work --3-- LABEL in EDIT Macro Commands a return code of 0 is returned instead of 4 in SPF/2 when nonexistant label is check for. See also LINENUM. "ISREDIT (LABNAME,LEVEL) = .NOLAB" --4-- (not being done it was ISPFEXEC in TSO when not caps) A change in the following form affects MSG only. "c all c'msg(isrz000)'", "'MSG(ISRZ000)'" /* msg(isrz000) msg msg() */ ----- */