Decimal to Hexadecimal Conversion

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
maragatham
Member
Posts: 2
Joined: Tue Jun 18, 2013 10:42 am

Decimal to Hexadecimal Conversion

Post by maragatham » Tue Jun 18, 2013 12:24 pm

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?

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Jun 19, 2013 1:20 am

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.
Last edited by DikDude on Wed Jun 19, 2013 5:20 am, edited 1 time in total.
Have a good one

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Wed Jun 19, 2013 3:49 am

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.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Fri Jun 28, 2013 5:51 pm

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!
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others