Edit macro HEXES Edit macro HEXES Author: David McRitchie formatted on 1995/04/01 06:54 for assistance contact: D. McRitchie DMcRitchie@hotmail.com -------------------------------------------------------------------------------- REXX execute NAME. HEXES users. Systems Programmers -- hex conversions type. Edit Macro resides in SYS1.TSOCLIST -------------------------------------------------------------------------------- HEXES Hex conversion of text within *HEX%% and %% -------------------------------------------------------------------------------- related HEXUS, HEXSHOW -------------------------------------------------------------------------------- Frequently HEX code is wanted in place of character data. Conversion can be tedious and subject to errors both in typing and in translat- ing. This REXX exec serves to simplify this task. There is a limitation on ISREDIT macro instructions, where a character string must be enclosed within either single quotes or double quotes but cannot contain the delimiter within the string. Due to this limi- tation the notes showing the FROM and the original record will not show double quotes, but they will be preserved. You will not be able to convert %% within the delimiters. -------------------------------------------------------------------------------- ISREDIT HEXES (no operands) -------------------------------------------------------------------------------- Examples EDIT ---- IS03.LIBR.CLIST(DUPTEST) - 01.07 ------------------ Columns 001 0 COMMAND ===> HEXES ****** ******************************* TOP OF DATA ************************ 000001 ABLE BAKER CHARLIE CHARLIE DOG &SUBSTR &SUBSTR A BB BB X 000002 THIS LINE CONTAINS SINGLE QUOTES ==> C ALL 'X' X'*HEX%%X%%' 000003 THIS LINE CONTAINS DOUBLE QUOTES ==> C ALL "X" X"*HEX%%X%%" 000004 ==> C ALL 'CTMI.V213.LOAD' X'*HEX%%CTMI.V213.LOAD%%' /* "'TEST'" 000005 REP 147EA8 *HEX%%RKH70X9H%% %%OLD%% ****** ******************************* BOTTOM OF DATA ********************* EDIT ---- IS03.LIBR.CLIST(DUPTEST) - 01.07 ------------------ Columns 001 0 COMMAND ===> RESET ****** ******************************* TOP OF DATA ************************ ==MSG> HEXES: 19:55:15 HEXES RC=4, NUMBER OF STRINGS CONVERTED = 3 =NOTE= HEXES: CONVERTS *HEX%%STRING%% TO THE HEX EQUIVALENT OF STRIN - - - - - - - - - - - - - - - - - - - - - - - - - - =NOTE= CHANGE X =NOTE= TO ... E7 ==MSG> THIS LINE CONTAINS SINGLE QUOTES ==> C ALL 'X' X'*HEX%%X%%' ==CHG> THIS LINE CONTAINS SINGLE QUOTES ==> C ALL 'X' X'E7' =NOTE= CHANGE X =NOTE= TO ... E7 ==MSG> THIS LINE CONTAINS DOUBLE QUOTES ==> C ALL X X *HEX%%X%% ==CHG> THIS LINE CONTAINS DOUBLE QUOTES ==> C ALL "X" X"E7" =NOTE= CHANGE C T M I . V 2 1 3 . L O A D =NOTE= TO ... C3E3D4C94BE5F2F1F34BD3D6C1C4 ==MSG> ==> C ALL 'CTMI.V213.LOAD' X'*HEX%%CTMI.V213.LOAD%%' /* 'TEST' .AA ==> C ALL 'CTMI.V213.LOAD' X'C3E3D4C94BE5F2F1F34BD3D6C1C4' /* "'TE =NOTE= CHANGE R K H 7 0 X 9 H =NOTE= TO ... D9D2C8F7F0E7F9C8 ==MSG= REP 147EA8 *HEX%%RKH70X9H%% %%OLD%% 000005 REP 147EA8 D9D2C8F7F0E7F9C8 RKH70X9H ****** ******************************* BOTTOM OF DATA ********************* EDIT ---- IS03.LIBR.CLIST(DUPTEST) - 01.07 ------------------ Columns 001 0 COMMAND ===> Scroll ===> CS ****** ******************************* TOP OF DATA ************************ 000001 ABLE BAKER CHARLIE CHARLIE DOG &SUBSTR &SUBSTR A BB BB X 000002 THIS LINE CONTAINS SINGLE QUOTES ==> C ALL 'X' X'E7' 000003 THIS LINE CONTAINS DOUBLE QUOTES ==> C ALL "X" X"E7" .AA ==> C ALL 'CTMI.V213.LOAD' X'C3E3D4C94BE5F2F1F34BD3D6C1C4' /* "'TE 000005 REP 147EA8 D9D2C8F7F0E7F9C8 RKH70X9H ****** ******************************* BOTTOM OF DATA ********************* Internal Aspects Internal aspects describes how this REXX execute functions. This in- formation is particularly useful to someone who may need to design a similarly functional REXX execute. It may also provide additional in- sight to the user. 1. Changes to the content are intended as stated in the purpose. 2. All lines are excluded from the display. 3. Lines are examined to find the occurrence of "*HEX%%". This line is held in dataname RECORD, which is translated to remove double quotes("). **after processing the terminating %%, the process will restart here to find the next "*HEX%%" line** The beginning location of "*HEX%%" is recorded as COL1. 4. The ending is found by searching the same card for the NEXT "%%" character string. 5. Once a string to be converted is located. The following process takes place. a. The terminating "%%" is recorded as COL2. The area between the delimiters will be saved as THATWORD. b. NEWWORD is created by REXX conversion function C2X (characters to hex), from THATWORD. c. A spaced out word SPACED is created with a minor DO loop from THATWORD for later display comparison to show the changed from characters to hex. d. The display are made. e. The change is made. f. If %%OLD%% exists on the same line after *%%HEXstring%%, the %%OLD%% will be replaced on the same line (the NEXT occurrence after the replacement). g. Any X'08' on the changed line are changed back to double quotes(x'7F'). h. If another starting "*HEX%%" is found on the same line process continues back at 4., otherwise the process continues back at 3..