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 

Translating files from ASCII to EBCDIC and back

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
John Corbin
Beginner


Joined: 23 Jan 2004
Posts: 38
Topics: 21

PostPosted: Fri Mar 18, 2005 11:19 am    Post subject: Translating files from ASCII to EBCDIC and back Reply with quote

Someone in my team had brought up the idea of translating a file from ASCII to EBCDIC. The ASCII file is a file from a lan server.

After some thought I got tasked with this...

I have a high level understanding of what to do. Here is my psuedo code:

OPEN ASCII input FILE
OPEN EBCDIC ouptut file

DO WHILE not end-of-file
TRANSLATE ( ASCII-string to EBCDIC-string )
WRITE EBCIDIC string to OUTPUT FILE
END

There would be two tables defined using XRANGE.

1 - ASCII_CHARS
2 - EBCDIC_CHARS

I have two questions:

1 - Will it be a good thing to translate 1 char at a time or will the TRANSLATE function allow me to specify the entire file as an input string.

2 - From the point of view of translating in general, are there any pitfalls to translating between these character sets that I should be aware of?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Mar 18, 2005 1:42 pm    Post subject: Reply with quote

John Corbin,

You don't have to write your own logic to translating ASCII to EBCDIC. FTP and IND$FILE can do the conversion. However there are some problems with the conversion.

Not all symbols get translated correctly.

A few of them are

1.exclamation mark (X'21') gets translated to vertical bar (X'4F')

2.Left square bracket (X'5B') gets translated to cents sign (X'4A')

3.Right square bracket (X'5D') gets translated to an exclamation mark (X'5A')

4. Caret (X'5E') gets translated to the Not symbol (X'5F')

And I think there is a problem even with X'80'-X'FF'

Also IBM supplied EZASOKET routines which can be called from any programming language.

The routines are :

EZACIC04 - Translate EBCDIC to ASCII

EZACIC05 - Translate ASCII to EBCDIC

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
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Fri Mar 18, 2005 1:49 pm    Post subject: Reply with quote

With all of the standard utilities that can convert data types (DFSORT, OCOPY, SAS to name a few), I would consider this task a bit unnecessary.

However, from the perspective of using the INTERPRET function in a REXX Exec (You didn't exactly state what language you planned to use), then the conversion occurs on a character-to-character basis. The nice thing is that you get to create your own conversion tables.
Back to top
View user's profile Send private message
John Corbin
Beginner


Joined: 23 Jan 2004
Posts: 38
Topics: 21

PostPosted: Fri Mar 18, 2005 3:01 pm    Post subject: Reply with quote

Thanks for the mention of EZACIC04 and EZACIC05...

I cannot find these in a standard REXX user manual....

The application where I have to use is:

Reports are generated by a COGNOS tool of some sort ( in ascii ) and need to be transmnitted to a minaframe that uses ebcdic.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Fri Mar 18, 2005 3:33 pm    Post subject: Reply with quote

The descriptions for EZACIC04 and EZACIC05 can be found in COBOL manuals.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Fri Mar 18, 2005 3:36 pm    Post subject: Reply with quote

Oops, my bad. I found them in the "z/OS V1R6.0 CS: IP Application Programming Interface Guide".
Back to top
View user's profile Send private message
arnold57
Beginner


Joined: 01 Oct 2004
Posts: 30
Topics: 0

PostPosted: Fri Apr 01, 2005 6:39 pm    Post subject: Reply with quote

You can create your own translate table for use with FTP if you don't like the standard one. Usually you would name it 'userid.STANDARD.TCPXLBIN'. The default tables are probably named 'TCPIP.STANDARD.TCPXLBIN'. You can use the CONVXLAT input-file output-file command to create a table. You may be able to find sample input by looking in 'TCPIP.SEZATCPX(STANDARD)' - but this may not be the name on your system.
Back to top
View user's profile Send private message
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Thu Feb 12, 2009 8:44 pm    Post subject: Reply with quote

kolusu wrote:
John Corbin,

You don't have to write your own logic to translating ASCII to EBCDIC. FTP and IND$FILE can do the conversion. However there are some problems with the conversion.

Not all symbols get translated correctly.

A few of them are

1.exclamation mark (X'21') gets translated to vertical bar (X'4F')

2.Left square bracket (X'5B') gets translated to cents sign (X'4A')

3.Right square bracket (X'5D') gets translated to an exclamation mark (X'5A')

4. Caret (X'5E') gets translated to the Not symbol (X'5F')

And I think there is a problem even with X'80'-X'FF'

Also IBM supplied EZASOKET routines which can be called from any programming language.

The routines are :

EZACIC04 - Translate EBCDIC to ASCII

EZACIC05 - Translate ASCII to EBCDIC

Hope this helps...

Cheers

kolusu



Kolusu :- Can this handle the chinese character also.

Our client add two ASCII characters X'1E' and X'1F' before and after DBCS characters in the input file, these two ASCII characters will be replace with EBCDIC SOSI characters X'0E' and X'0F' during when mainframe ftp transfer the input file from ASCII to EBCDIC. Base our test result, any ASCII non-DBCS characters stay between X'1E' and X'1F' will be discard, so if client add X'1E' and X'1F' in wrong position or forget add it, it will cause their input data field decrease or increase length. In other words, if Client add X'1E' and X'1F' in correct position and never forget add it, the input file will be transfer by ftp perfectly.

Can EZACIC05 handle this.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Feb 13, 2009 11:30 am    Post subject: Reply with quote

infoman123,

Check this

http://publib.boulder.ibm.com/infocenter/hodhelp/v9r0/index.jsp?topic=/com.ibm.hod9.doc/help/codepage.html

Kolusu
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 -> TSO and ISPF 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