MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Binary to EBCDIC

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Mon Jan 10, 2005 10:37 am    Post subject: Binary to EBCDIC Reply with quote

Hi,

Can anyone please suggest me a translation table from BINARY to EBCDIC (Values in Hex).
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Jan 10, 2005 11:18 am    Post subject: Reply with quote

You need to explain what you want in more detail since what you've said does not really make any sense. Show an example of what your input looks like and what you want your output to look like.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Mon Jan 10, 2005 11:30 am    Post subject: Reply with quote

Hi Frank,

I have an input file with Binary Data, which is difficult to interpret. I want to read this data and converting to EBCDIC should help me understand the data.

The input binary data looks something like this:
n.
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Jan 10, 2005 12:31 pm    Post subject: Reply with quote

Programmer1,

You can binary fields into readable format using editing masks. For ex if you have binary field at pos1 for 4 bytes , you can use the following JCL to convert the binary field to readable numeric field.

Code:

//STEP0100 EXEC PGM=SORT                 
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD DSN=YOUR INPUT FILE,       
//            DISP=SHR                   
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                           
 SORT FIELDS=COPY                         
 OUTFIL OUTREC=(1,4,BI,EDIT=(TTTTTTTTT)) 
/*


You can code the same for all other fields also.

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Jan 10, 2005 1:46 pm    Post subject: Reply with quote

In order to "decode" the data as numerics in the way that Kolusu suggests, you would have to know what kind of numerics the data represents. For example, if you have these 4 hex bytes:

0123456C

they probably represent a PD field, not a BI field, so you'd need to use:

1,4,PD,edit

instead of:

1,4,BI,edit

But from what you've said, you don't have any idea what the binary data represents. So your first step would be to display the data as hex characters. Assuming your input file has RECFM=FB and LRECL=80, you can use the following DFSORT job to display the data as hex:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTREC FIELDS=(1,80,HEX)
/*


If your input file has other attributes, you can change the job accordingly.

By looking at the hex display of the binary data, you may be able to figure out what it represents, and then display it more appropriately.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Tue Jan 11, 2005 5:11 am    Post subject: Reply with quote

Frank,

Will "HEX ON" give me the same results as this JCL ?

If not, what is the difference between using this JCL and using "HEX ON" to view the Binary data ?
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Tue Jan 11, 2005 5:15 am    Post subject: Reply with quote

Kolusu,

The Binary data that I am using would also be having some characters and special characters with the numerals.

I understand that your JCL would be helpful if all the data is surely numeric.

Is there a way to translate this data as single string ? Or will I always have to break the data into bytes to convert?
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jan 11, 2005 11:10 am    Post subject: Reply with quote

Programmer1,

Yes, there are other ways to view the data in hex, including using HEX ON.
But viewing it in hex is only an intermediate step to show you what the data looks like so you can see how to interpret it more approrpriately.
Ideally, you would have a mapping of the data from whoever created it so you knew what it actually represented.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Tue Jan 11, 2005 11:45 am    Post subject: Reply with quote

Thanks Frank,

Can you please confirm a very trivial thing:

Is it true that if we do a HEX ON on a numeric data (in Binary Format), it will display the actual numeral ?

For example:

Lets take 75,

Now will "HEX ON" on Binary representation of 75 will show me 75 on the screen ?
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jan 11, 2005 12:14 pm    Post subject: Reply with quote

Are you talking about HEX ON under ISPF EDIT? If so, then it just shows you the hex representation of each character, just like DFSORT's p,m,HEX does. If the binary character is X'75', then the hex representation is 75 and that's what HEX ON will show you. For example:

[code:1:553e382585]
000013
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
programmer1
Beginner


Joined: 18 Feb 2004
Posts: 138
Topics: 14

PostPosted: Tue Jan 11, 2005 12:33 pm    Post subject: Reply with quote

Yes Frank,

This answers my question. But I am still stuck with my binary data Neutral .

I got confused because when I looked at the HEX representation of my data, I actually got the expected numeral.

I must read some literature on these data representations first.

anyway, thank you very much for your time and help.
_________________
Regards,
Programmer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jan 11, 2005 1:00 pm    Post subject: Reply with quote

You can find some information about the hex representations of various formats in Appendix C of "DFSORT Application Programming Guide" at:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/C.1?SHELF=&DT=20031124143823&CASE=

Some examples:

Code:

1-byte CH: X'F5' = character '5'
1-byte CH: X'C5' = character 'E'
1-byte CH: X'D5' = character 'N'
1-byte BI: X'05' = decimal +5
1-byte BI: X'F5' = decimal +245
1-byte FI: X'05' = decimal +5
1-byte FI: X'F5' = decimal -11
1-byte ZD: X'F5' = decimal +5
1-byte ZD: X'C5' = decimal +5
1-byte ZD: X'D5' = decimal -5
1-byte PD: X'5C' = decimal +5
1-byte PD: X'5D' = decimal -5
2-byte BI: X'C203' = decimal 49667
2-byte FI: X'C203' = decimal -15869
2-byte ZD: X'F2F3' = decimal +23
2-byte ZD: X'F2D3' = decimal -23
2-byte PD: X'123C' = decimal +123
2-byte PD: X'123D' = decimal -123


You can see that you really need to know the format you're dealing with in order to interpret the value correctly. Once you know the format of the data, you can use DFSORT or DFSORT's ICETOOL to convert numeric types to displayable characters or to other numeric types.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group