In my last posted question, the suggestion was made to create a table of 256 characters and then to use the EXAMINE TRANSLATE statement where every alphanumeric character I’m searching would translate to itself and all others would translate to something else, like “#”.
I’m trying an exercise where I load the hex values of of the EBCDIC character set into a table.
Here’s what I have so far:
01 #TRANSLATE-TBL(A2/256)
01 #HEX-VALUE(A1/1:16) INIT <'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'>
01 #H1(A2)
01 #H2(A2)
FOR #A 1 16
MOVE #HEX-VALUE(#A) TO SUBSTR(#H1,1,1)
FOR #B 1 16
MOVE #HEX-VALUE(#B) TO SUBSTR(#H1,2,1)
IF #H1 = 'C1' THRU 'C9' OR /* IF ALPHANUMERIC, MOVE #H1 TO #H2
#H1 = 'D1' THRU 'D9' OR
#H1 = 'E2' THRU 'E9' OR
#H1 = 'F0' THRU 'F9'
MOVE #H1 TO #H2
ELSE
MOVE '7B' TO #H2 /* ELSE MOVE '#' TO #H2
END-IF
ADD 1 TO #TBL-CTR
** here's where I'm stuck --
** instead of moving a constant (e.g., H'007B') to #TRANSLATE-TBL(#TBL-CTR), can I move the hex representation of a variable?
**
END-FOR
END-FOR
and then later I would use
EXAMINE #NAME TRANSLATE USING #TRANSLATE-TBL(*)
EXAMINE #NAME FOR '#' DELETE