View previous topic :: View next topic
|
Author |
Message |
srikanth_ponnapalli
New User
Joined: 17 Aug 2006 Posts: 1 Location: bangalore
|
|
|
|
hi guys,
Can anyone explain me how to convert ALPHANUMERIC DATA into HEXA DECIMAL data format in an ENTERPRISE COBOL.Could you please send me a sample code if possible.
Regards
Srikanth Ponnapalli |
|
Back to top |
|
|
sdpk_ind
New User
Joined: 07 May 2006 Posts: 4
|
|
|
|
if the data is in a dataset, then put 'hex on' in the command line to convert from alphanumeric to hexadecimal and 'hex off' to change it to alphanumeric. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Code: |
05 numbytes pic 99 comp
05 dispbytes redefines
numbytes.
10 twobyte pic x.
10 onebyte pic x.
move low-values to twobyte.
move 'A' to onebyte.
multiply numbytes by 16.
inspect onebyte converting
from X'00102030405060708090A0B0C0D0E0F0'
TO X'F0F1F2F3F4F5F6F7F8F9C1C2C3C4C5C6'.
inspect twobyte converting
from X'000102030405060708090A0B0C0D0E0F'
TO X'F0F1F2F3F4F5F6F7F8F9C1C2C3C4C5C6'.
display dispbytes.>>>>>>>>>"C1"
|
|
|
Back to top |
|
|
|