Moving files to and from z/OS

Encoding on z/OS

The default encoding on z/OS is EBCDIC (or IBM-1047 as it is also known). It is very different from ASCII or from UTF-8, i.e. there are no common character ranges between it and ASCII/UTF-8 (whereas the range 0-127 is common/same for ASCII and UTF-8). That is why any text in EBCDIC viewed as ASCII/UTF-8 looks unintelligible and vice versa.

Here is one way to deal with this encoding peculiarity on z/OS during development/test: Use the TEXT and BINARY modes of ftp for transferring text files to/from z/OS. When BINARY mode is used, then the file is transferred as is thus obtaining a bit-by-bit identical replica of the file on the destination system. When using TEXT, however, the ftp client/server does an encoding conversion under the covers -- the file is converted from the native encoding of the source system to the native encoding of the destination system. Here are a few examples:

  1. You can read the log file produced by TDI on z/OS by using ftp in TEXT mode to transfer the file to your Windows machine - then the file will look like a normal text file on Windows. Of course, you can read the log file on z/OS with the cat command, or in vi.
  2. Normally TDI config files are encoded in UTF-8. You must transfer a TDI config in UTF-8 using BINARY mode in order for TDI to be able to read it on z/OS.

In general:

  • any binary file (a JAR file, a picture, etc.) must be transferred using BINARY mode
  • if you need to have a text file in z/OS-native encoding (EBCDIC) on the z/OS system you can get a text file on Windows and transfer it in TEXT mode to the z/OS system; alternatively you can create that file natively on z/OS using vi, for example.
  • if you need to have a text file on z/OS in an encoding different than the default encoding on z/OS, you can either use the iconv tool available on z/OS USS for converting from one encoding to another, or have the file in the correct encoding (for example, UTF-8 which contains some Chinese symbols) on Windows and then use BINARY mode to transfer it to the z/OS system.

TDI in ASCII mode on z/OS

IBM products bundling TDI (like TIM) that run on z/OS may also be running TDI on z/OS. Some applications (like TIM) need TDI to be run in ASCII mode because of some libraries used. This can be done by configuring the JVM on z/OS.

Normally the default encoding of the JVM is the same as the default encoding for the platform - in case of z/OS it is EBCDIC. There is, however, a way to change the default encoding the JVM by setting the file.encoding Java system property on the command line. This is what we have done in the ibmdisrv_ascii script. Changing the default encoding of the JVM means that anywhere where an encoding is implicitly used this implicit encoding will be different.

One of the effects of running in ASCII mode, for example, is that the output log file will be in ASCII instead of EBCDIC, so in order to read this file on Windows you would need to transfer it using BINARY transfer.

(thanks to Kraicho Kraichev for this lovely dissertation!)

-- EddieHartman - 15 Aug 2006
Topic revision: r1 - 15 Aug 2006, EddieHartman - This page was cached on 04 Aug 2023 - 15:09.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TDI Users? Send feedback