Convert EBCDIC data into an alphanumeric character string



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Re: Convert EBCDIC data into an alphanumeric character string

Postby hakghen » Fri Sep 12, 2008 2:39 am

Hello Dick!

Sorry, I misstook ASCII for "alphanumeric character string". The requiremente is the same as Orlando's one: convert this text to a comprehensible text, but I think he already figured out how-to (and what we are really supposed to do).

The text's characters are stored in mini-2bytes'-hexes and we have a conversion chart... So, read the hex value, change to BIN and change again to ASCII, so we get the correct text...

Well, ultil now I'll also do it manually (changing byte and byte), as the text would be like:

D6 E2 40 D6 D9 C7 C1 D5 C9 E9 C1 C4 D6 D9 C5 E2 40 C4 D6 40 7F C3 D6 D5 C3 E4 D9 E2 D6
D4 C1 C9 D5 C6 D9 C1 D4 C5 7F 40 C7 D6 E2 E3 C1 D9 C9 C1 D4 40 C4 C5 40 C1 C7 D9 C1 C4 C5 C3 C5 D9
D7 D6....etc and so on...

I noticed you made a code there but as I never worked with the COBOL language and we're also using z/os, I don't have any idea of how to use it xP

But, Thanks for the help :D

[]'s, André Luiz!
[]'s,

Hakghen
User avatar
hakghen
 
Posts: 59
Joined: Thu Sep 11, 2008 8:15 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Re: Convert EBCDIC data into an alphanumeric character string

 

Re: Convert EBCDIC data into an alphanumeric character string

Postby dick scherrer » Fri Sep 12, 2008 3:00 am

Hello,

I believe there is still some confusion - the part about the ascii. . .
So, read the hex value, change to BIN and change again to ASCII, so we get the correct text...
For example in your file the first "character is an x'D6'. This is an ebcdic letter O (oh). The ascii for a letter O is x'4F'. They have different binary values, not the same. The ebcdic to ascii conversion handles this when test files are transmitted either way.

Similarly an ebcdic x'F0' is a zero whereas an ascii zero is x'30'.

I really hate to hear you are doing the conversion by hand, but i believe it would be even more of a pain if the result is not what you need. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Convert EBCDIC data into an alphanumeric character string

Postby hakghen » Fri Sep 12, 2008 3:14 am

Well, sure, it would be really faster if there was an automated way to do it, but to make it simple, we did this:

- Get the value (for example, the D6)
- Change it do BIN using Window's Calc, receiving the 11010110 value
- Then, search this table: http://publib.boulder.ibm.com/infocente ... a20534.htm for it's symbol.

After translating, we got the message (at least, it's ok and truly understandable)...

This should clear things up... It's some kind of IBM's Mainframe Training so I think they did it so we could get ourselves used and to know a bit of EBCDIC...
[]'s,

Hakghen
User avatar
hakghen
 
Posts: 59
Joined: Thu Sep 11, 2008 8:15 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Convert EBCDIC data into an alphanumeric character string

Postby dick scherrer » Fri Sep 12, 2008 3:24 am

Hello,

This should clear things up... It's some kind of IBM's Mainframe Training so I think they did it so we could get ourselves used and to know a bit of EBCDIC.
Yup, it surely does. . . 8-)

Someone will be here if there are questions.

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Convert EBCDIC data into an alphanumeric character string

Postby teatea » Mon Jun 29, 2009 5:36 am

I know this might be bumping the topic up a little (by like several months), but I needed a solution for something very similar. I know this might seem rude, as it is my first post, but none of this actually helped. After having a bit of thought, I realised why.

The original post's bit of code isn't actually EBCDIC. It's actually EBCDIC converted to hexidecimal, or the hexidecimal representation of EBCDIC. So at this point, for anyone looking for similar solutions if they are stuck, if there is an exercise where you apparently have to convert EBCDIC to alpha numerical terms and it is in the form of something similar to E3C8C9E240E8C5C1D9E240E3D9C1D5E2D3C1E3C9D6D540C5E7C5D9C3C9E2C540E6C9D3D3, it is best to actually see it as a hexidecimal (8-bit coding) rather than EBCDIC. That is a large confusion everyone on this thread had misinterpreted.

I believe you all thought it to be EBCDIC but it is NOT PURE EBCDIC but rather the hexidecimal version of it. So best to get Hex - > EBCDIC conversion. That is what they mean by 8-bit. In the world of programming, 8-bit generally means hexidecimal format. I hope future remember that anything in the form of letters (A-F) and numbers (0-9) are hexidecimals. Each term are in pairs.
teatea
 
Posts: 1
Joined: Mon Jun 29, 2009 5:21 am
Has thanked: 0 time
Been thanked: 0 time

Re: Convert EBCDIC data into an alphanumeric character string

Postby dick scherrer » Mon Jun 29, 2009 6:12 am

Hello and welcome to the forum,

but I needed a solution for something very similar.
Rather than what you posted, you might have posted the requirement you wanted a "solution" for. . .

I believe you all thought it to be EBCDIC but it is NOT PURE EBCDIC but rather the hexidecimal version of it
And for some reason you believed this was not the common understanding by the last reply? I suppose this
It is ebcdic, but maybe not the way you intended.

Somehow, you have data that is showing each byte as 2 bytes - ie this is the hex construction of each byte. Often someone wants to show the hex values of some data, but it is rare to have the hex in 2-byte form as input. . .
from early in the topic escaped you :?

I know this might seem rude, as it is my first post, but none of this actually helped.
It did not help because it most likely had nothing to do with what you needed.

If you have something that needs clarification, post what you are looking for and someone here may be able to clarify.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Convert EBCDIC data into an alphanumeric character string

Postby Frank Yaeger » Fri Oct 29, 2010 1:36 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 functions for various types of conversion mentioned in this thread and more, e.g.

TRAN=ATOE - convert ASCII to EBCDIC
TRAN=ETOA - convert EBCDIC to ASCII
TRAN=HEX (or HEX) - convert binary to EBCDIC hex
TRAN=UNHEX - convert EBCDIC hex to binary
TRAN=BIT - convert binary to EBCDIC bits
TRAN=UNBIT - convert EBCDIC bits to binary

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: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: Convert EBCDIC data into an alphanumeric character strin

Postby zoom » Thu Mar 17, 2011 5:39 am

I have the same issue, can some one help me in figuring this out.

We are getting a ebcdic file from 3rd party ( so there is no way we can access their server and mainframe environment). We got to convert this ebcdic in to ascii format in to a database table.

Is there any tool or any automated process to get this done?
zoom
 
Posts: 4
Joined: Thu Mar 17, 2011 5:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Convert EBCDIC data into an alphanumeric character strin

Postby Robert Sample » Thu Mar 17, 2011 6:25 am

There are multiple versions of EBCDIC, so if you're dealing with special characters such as left and right square bracket, you could be in for some surprises. Unix System Services has the utility iconv which converts one code page (such as EBCDIC) to another (such as ASCII). You can read about it in the Unix System Services User's Guide manual. There are many ways this conversion can be done; Google is your friend -- Googling z/OS EBCDIC to ASCII returns 78,800 hits.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: Convert EBCDIC data into an alphanumeric character strin

Postby zoom » Thu Mar 17, 2011 10:42 am

I tried couple of tools but didn't get much help.

When i open the data file using Hex editor data looks : 02 01 01 21 7C

when i convert this to EBCDIC text , it is <STX><SOH><SOH><SOS>@ . But my target data should be 20101217.

Help should be appreciated.
zoom
 
Posts: 4
Joined: Thu Mar 17, 2011 5:34 am
Has thanked: 0 time
Been thanked: 0 time

PreviousNext

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post