I have an 8 character Hex field (which happens to be an IDMS dbkey) - for example: 3B823417 - and I need to be able to process an input file contains a number of records with this data.
Such as
//INFILE DD *
3B823417
3B82340C
/*
I know that I can turn HEX on in tso but to enter the values I will have to manually type them into the two rows.
so it would look like
000001 b b 17 3899960 23 0998389783
3831444444444383144FF4FFFFFFF4FF44FFFFFFFFFF4444
B247000000000B2470017038999600230009983897830000
or more simply
3831
B247
But I need to know how I can enter 8 characters of hex data 3B823417 and get the COBOL program to "understand" or read it as though it were a COMP with the 4 bytes = '3B823417'. (which converts to 0998389783 in decimal - which I will then be able to use as the DBKEY in an IDMS command "FIND DB-KEY w-dbkey"
The have DFSORT, so if there were convesion option I could try that as well.
Joined: 23 Nov 2006 Posts: 13611 Location: 221 B Baker St
Hello and welcome to the forum,
One way to do what you want is to create an array that contains all of the 2-char values from 00 to FF and the one-byte hex equivelent.
For example the array entry for 3B would have a 1-byte result value of x'3B'. This entry might be:
05 char3B pic xx value '3B'
05 hex3B pic x value x'3B'
The array would have 256 entries - from 00 thru FF.