Convert HEX to EBCDIC



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Convert HEX to EBCDIC

Postby graham777 » Wed Sep 22, 2010 11:43 am

I have a file that contains a mix of EBCDIC text and HEX.
EG. 46000102D0
I am trying to use DFSORT & OUTREC to convert the chars from position 7 to 10 back to EBCDIC.
eg. 460001 }
In essence there is an existing program that unpacks the characters to decipher them.

Note that I can get from the 460001 } value to the 46000102D0 value by using the following:
OUTREC FIELDS=(1:1,6,
7:7,54,HEX,X)

What I cant do is get it back the other way.
graham777
 
Posts: 2
Joined: Wed Sep 22, 2010 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Convert HEX to EBCDIC

Postby Frank Yaeger » Wed Sep 22, 2010 10:28 pm

EBCDIC and HEX are meaningless terms the way you're using them. Maybe you mean character and binary or maybe you mean something else.

I don't know what you mean by "convert the characters from position 7 to 10 back to EBCDIC"?

C'2D0' is X'F2C4F0' ... that is a character representation and a hex representation. Both are EBCDIC.

Show your input field in hex and your expected output field in hex so I can understand the conversion you're actually trying to do.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Convert HEX to EBCDIC

Postby graham777 » Thu Sep 23, 2010 2:05 am

Sorry bout confusion - everything is in essence ebcdic I am really just talking about packing and unpacking as per the following.
I want to go from:
46000102D0
to:
460001 }
0D (hex)
20 (hex)
So chars 02 (position 7 & 8) go to a single char (which may or may not be printable) but is hex x'02'
& chars D0 (position 9 & 10) go to a single char x'D0'

I haven't noted the hex for the first 6 chars (haven't go access to mainframe at moment) but they will just be normal ebcdic characters.
graham777
 
Posts: 2
Joined: Wed Sep 22, 2010 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Convert HEX to EBCDIC

Postby Frank Yaeger » Thu Sep 23, 2010 2:50 am

That isn't really packing and unpacking. It's converting HEX in character representation to equivalent binary. I can't think of an easy way to do that with DFSORT. Maybe somebody else can.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Convert HEX to EBCDIC

Postby Frank Yaeger » Thu Oct 28, 2010 2:50 am

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct, 2010), you can now use DFSORT's new TRAN=UNHEX function to do this kind of thing quite easily like this:

    INREC BUILD=(1,6,7,4,TRAN=UNHEX)


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

http://www.ibm.com/support/docview.wss? ... g3T7000242
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post