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.
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.
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!