Page 1 of 1

Decimal to Hexadecimal Conversion

Posted: Tue Jun 18, 2013 12:24 pm
by maragatham
Hi,
I have been trying to convert a Decimal value in my input file to a hexadecimal value. My I/P data is not of a fixed length and can vary anywhere between 7 to 10 digits.
After Hexadecimal conversion, I am well aware that the max length will 10 characters.

Sample records in My I/P file :

Code: Select all

36812870 
411942189
692556828
6969540
696955760
698031146
702103818
The below command did not give me the expected result.
My expected results is

Code: Select all

231B846
188DBD2D


//JS030 EXEC PGM=SORT
:
:
SORT FIELDS=COPY
OUTREC FIELDS=(1,10,ZD,TO=BI)

I have been searching the forum and was unable to proceed. Could you please assist?

Posted: Wed Jun 19, 2013 1:20 am
by DikDude
How did you determine you want those results?

How did 7 input records become 2 lines of output?

What do you mean by "hexidecimal"? Everything stored on the mainframe is stored in hexidecimal.

Posted: Wed Jun 19, 2013 3:49 am
by William Collins
In addition to what you have been asked, have you checked on available datatypes and default lengths? For instance, ZD fields do not contain blanks, so with the examples you have shown, you cannot expect to get correct results, you need to find a datatype which can deal with (ignore) blanks.

Posted: Fri Jun 28, 2013 5:51 pm
by Anuj Dhawan
Something does not match up here - as Dick said, how did 7 input records become 2 lines of output - is a mystery to me too.

Also what Sort Product are you using? If you're using DFSORT and DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 - you can use DFSORT's new TRAN=HEX function to do this but that also won't do the magic of 7-input-records-to-2-output-records!