+

Search Tips | Advanced Search

Transferring files to or from IBM i systems

If you transfer files to or from IBM® i systems using Managed File Transfer in text mode and you want to convert the data in the files, consider the information in this topic.

Each file on an IBM i system is tagged with a coded character set ID (CCSID) value that identifies the data encoding of the file. For example, a file containing EBCDIC data might have a CCSID value of 037 and a file containing ASCII data might have a CCSID value of 819.

For text mode transfers, Managed File Transfer converts data when there are file encoding differences between source and destination files. However, Managed File Transfer currently ignores CCSID tags associated with files on IBM i systems. Instead, it uses the JVM file encoding property of the JVMs running the source agent and destination agent. The default value of this property is based on locale (but we can override this default on your IBM i system using the SystemDefault.properties file described in the following section:Change the file.encoding record in the SystemDefault.properties file). With this default implementation, an agent that transfers files in text mode is limited in its ability to handle text files with different file encodings. For example, we cannot use the same agent to transfer files containing EBCDIC text and also files containing ASCII text without stopping and restarting the agent with the appropriate (that is, EBCDIC or ASCII) file encoding override in place. On IBM i V6R1 systems, we can check the file encoding value of the JVM that is running the agent job by using WRKJVMJOB, option 7 to Display Current® Java System Properties. (The WRKJVMJOB command does not exist on IBM i V5R4 systems.)

If you plan to use Managed File Transfer to transfer text files with different file encodings, consider creating multiple agents and multiple users who start those agents, so that each unique encoding has an agent that is ready and enabled to transfer that type of data.

For example, if you want to transfer a file containing EBCDIC text with CCSID value of 037 from an IBM i system (source) to another IBM i V6R1 system (destination) where you want the file content at the destination to be converted to ASCII text with CCSID value of 819, complete the following steps:
  1. Select a source agent with a JVM file encoding of Cp037.
  2. Select a destination agent with a JVM file encoding of ISO8859_1.
  3. Select text mode transfer, and other specifications as needed.


Change the file.encoding record in the SystemDefault.properties file

To enable a JVM running an agent for a particular encoding, complete the following steps:

  1. Determine which user starts the agent that runs on the IBM i system. This is the agent that services the Managed File Transfer file transfer request.Create a SystemDefault.properties file in the home directory of that user as needed. For example, if you start the agent, use Qshell to run the following command:
    touch -C 819 /home/your_userID/SystemDefault.properties 
  2. Use Qshell, run the /qibm/proddata/mqm/bin/fteStopAgent command to stop the agent as needed.
  3. Update the SystemDefault.properties file that is described in step 1 to ensure that the file contains a record like the following:
    file.encoding=java_encoding
    where java encoding corresponds to the type of data that is contained in the file, and matches a file.encoding value from the following table: File.encoding values and System i5® CCSID.
  4. The user identified in step 1 must complete the following steps:
    1. On IBM i V5R4 only: add the QIBM_PASE_DESCRIPTOR_STDIO environment variable (*JOB scope) to 'B' if using EBCDIC file encoding, or 'T' if using ASCII encoding. For example:
       ADDENVVAR ENVVAR('QIBM_PASE_DESCRIPTOR_STDIO') VALUE('B') REPLACE(*YES) 
    2. If Qshell is active, press F3=Exit to end Qshell.
    3. Start Qshell and run the /qibm/proddata/mqm/bin/fteStartAgent command as appropriate to restart the agent.

When the file encoding of the JVM running the agent has been changed, the agent log is written with that encoding. If you want to read the contents of the agent log, you must use a viewer that is enabled for that encoding.


Use a transfer definition for data conversion

An alternative way to convert data when files are being transferred is to create a transfer definition that specifies file encoding, or to use the -sce and -dce parameters of the fteCreateTransfer command. If we use these parameters when the destination is an IBM i system, this can result in files that have incorrect CCSID tags. For this reason, the recommended approach for controlling data conversion with files that are located on IBM i systems is to use SystemDefault.properties as described in the preceding section.


Protocol bridge limitation

On IBM i, we cannot transfer EBCDIC files to or from an SFTP server using a protocol bridge agent.