Hello. I’m trying to display the conversion of hex constants in an understandable format. For example, in the documentation there are:
- H’313233’ hexadecimal constant is equal to ‘123’
- H’414243’ hexadecimal constant is equal to ‘ABC’
and I would like to know how to print H’313233’ so it shows ‘123’.
I’ve already tried:
DEFINE DATA LOCAL
1 #HEX-1 (A07) INIT<H’313233’> /* ‘123’
1 #HEX-2 (A07) INIT<H’414243’> /* ‘ABC’
END-DEFINE
*
WRITE ‘=’ #HEX-1(EM=HHHHHHH)
But it prints only in hexadecimal format. Could anybody help me?
Thanks in advance.
WRITE ‘=’ #HEX
since the field is defined as format A, that is all you have to do.
1 Like
Please note that you will never get the output you are looking for on Natural Mainframe (EBCDIC) because the INIT values used here are ASCII.
You would need
DEFINE DATA LOCAL
1 #HEX-1 (A07) INIT<H’F1F2F3’> /* ‘123’
1 #HEX-2 (A07) INIT<H’C1C2C3’> /* ‘ABC’
END-DEFINE
1 Like
Hi Douglas,
I just tried it, but the result I get is:
#HEX: ???
system
(system)
Closed
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.