View previous topic :: View next topic |
Author |
Message |
John Corbin Beginner
Joined: 23 Jan 2004 Posts: 38 Topics: 21
|
Posted: Fri Mar 18, 2005 11:19 am Post subject: Translating files from ASCII to EBCDIC and back |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Mar 18, 2005 1:42 pm Post subject: |
|
|
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 |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Fri Mar 18, 2005 1:49 pm Post subject: |
|
|
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 |
|
 |
John Corbin Beginner
Joined: 23 Jan 2004 Posts: 38 Topics: 21
|
Posted: Fri Mar 18, 2005 3:01 pm Post subject: |
|
|
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 |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Fri Mar 18, 2005 3:33 pm Post subject: |
|
|
The descriptions for EZACIC04 and EZACIC05 can be found in COBOL manuals. |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Fri Mar 18, 2005 3:36 pm Post subject: |
|
|
Oops, my bad. I found them in the "z/OS V1R6.0 CS: IP Application Programming Interface Guide". |
|
Back to top |
|
 |
arnold57 Beginner
Joined: 01 Oct 2004 Posts: 30 Topics: 0
|
Posted: Fri Apr 01, 2005 6:39 pm Post subject: |
|
|
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 |
|
 |
infoman123 Beginner
Joined: 02 Nov 2004 Posts: 57 Topics: 20
|
Posted: Thu Feb 12, 2009 8:44 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
|
|