/* REXX -- HEXES */ /* HEXES: Substitutes HEX code for *HEX%%xxxx%% string */ /* author: David McRitchie, "The REXX Macros Toolbox" 1990/09/15 */ /* contact: David McRitchie, "The REXX Macros Toolbox" */ /* documentation available: http://www.geocities.com/davemcritchie/rexx01/txt/hexes.txt */ /* This clist is universally available with the stipulation that */ /* the original author remains credited */ /* and that no charge or licensing fee accrues to any party. */ /* This will be my 3rd meaningful REXX execute */ /* TEST WITH DATA IN -- Self testing, or use IS03.LIBR.CLIST(duptest)*/ Address "ISREDIT" /* this and that and that and that*/ "MACRO" xcnt = 0 "LOC .zfirst" /* word repeated is the word reset */ "reset" "exclude all" "LINE_BEFORE .ZFIRST = NOTELINE 'HEXES: converts " , "*HEX%%string%% to the hex equivalent of string'" MAXCC = 0 LASTWORD = '##' /*self-testing duplicate is ... dodo dodo */ do forever "LABEL .zcsr = .aa 0" "SEEK NEXT '*HEX%%'" lastrc = rc IF lastrc \= 0 THEN do; "loc .zfirst"; ZEDSMSG = "hexes rc="||maxcc ZEDLMSG = zedsmsg msg = "HEXES:" TIME('N') zedsmsg , || ", number of strings converted = " xcnt "'" "LINE_AFTER 0 = MSGLINE (msg)" address ISPEXEC 'SETMSG MSG(ISRZ000)' "up max" return(maxcc); end; "(RECORD) = LINE .ZCSR " DRECORD = TRANSLATE(RECORD,x2c(08),x2c(7F)) /* ' " */ do while(lastrc = 0); /* second dumb dodo dodo*/ "(LINEx,COL1) = CURSOR" "SEEK NEXT '%%' .ZCSR .ZCSR" "SEEK NEXT '%%' .ZCSR .ZCSR" lastrc = rc IF lastrc = 0 then do; "(linex,COL2) = CURSOR" /* *hex%%abc.def%% */ /* 1...5...10...15 */ THATWORD = substr(RECORD,(col1+6),(col2 - col1 - 6)) NEWWORD = c2x(thatword) spaced = "" do i = (col1+6) to (col2 - 1); SPACED = SPACED || SUBSTR(DRECORD, I, 1 ) || " "; end; notex = "Change " || SPACED "LINE_BEFORE .ZCSR = NOTELINE (notex)" notex = "To ... " || NEWWORD "LINE_BEFORE .ZCSR = NOTELINE (notex)" "LINE_BEFORE .ZCSR = MSGLINE (DRECORD)" "change '*hex%%" || THATWORD || "%%' '" , || NEWWORD || "' all .zcsr .zcsr " lastrc = rc if lastrc = 0 then do; xcnt = xcnt + 1 "change '%%OLD%%' '" || THATWORD || "' next .zcsr .zcsr" end; else maxcc = max(maxcc,4) "RESET .ZCSR .ZCSR CHANGE" "SEEK NEXT '*HEX%%'" .zcsr .zcsr lastrc = rc end; end; end;