Data conversion

When you access files through the integrated file system, data in the files may or may not be converted, depending on the open mode requested when the file is opened.

An open file can be in one of two open modes:

Binary
The data is read from the file and written to the file without conversion. The application is responsible for handling the data.
Text
The data is read from the file and written to the file, assuming it is in textual form. When the data is read from the file, it is converted from the coded character set identifier (CCSID) of the file to the CCSID of the application, job, or system receiving the data. When data is written to the file, it is converted from the CCSID of the application, job, or system to the CCSID of the file. For true stream files, any line-formatting characters (such as carriage return, tab, and end-of-file) are just converted from one CCSID to another.

When reading from record files that are being used as stream files, end-of-line characters (carriage return and line feed) are appended to the end of the data in each record. When writing to record files:

  • End-of-line characters are removed.
  • Tab characters are replaced by the appropriate number of blanks to the next tab position.
  • Lines are padded with either blanks (for a source physical file member) or nulls (for a data physical file member) to the end of the record.

On an open request, one of the following can be specified:

Binary, Forced
The data is processed as binary regardless of the actual content of the file. The application is responsible for knowing how to handle the data.
Text, Forced
The data is assumed to be text. The data is converted from the CCSID of the file to the CCSID of the application.

A default of Binary, Forced is used for the integrated file system open() function.

Related information
open() API