File systems

i5/OS™ PASE programs can access any file or resource that is accessible through the integrated file system, including objects in the QSYS.LIB and QOPT file systems.

Buffered input and output

Input and output to and from external devices is buffered on i5/OS; it is handled by input and output processors that deal with blocks of data. Conversely, operating systems, such as AIX® and Linux®, typically operate with character-by-character (unbuffered) input and output. On i5/OS, only certain input and output signals (for example, the Enter key, function keys, and system request) send an interrupt to the system.

Data conversion support

i5/OS PASE programs pass ASCII (or UTF-8) path names to the open() function to open byte stream files, where the name is automatically converted to the encoding scheme used by i5/OS, but any data read or written from the open file is not converted.

Use of file descriptors

The i5/OS PASE run time normally uses ILE C run time support for files stdin, stdout, and stderr, which provide consistent behavior for i5/OS PASE and ILE programs.

i5/OS PASE and ILE C use the same streams for standard input and output (stdin, stdout, and stderr). i5/OS PASE programs always access standard input and output using file descriptors 0, 1, and 2. ILE C, however, does not always use integrated file descriptors for stdin, stdout, and stderr, so i5/OS PASE provides a mapping between i5/OS PASE file descriptors and descriptors in the integrated file system. Because of this mapping, i5/OS PASE programs and ILE C programs can use different descriptor numbers to access the same open file.

You can use the i5/OS PASE extension on the fcntl function, F_MAP_XPFFD, to assign an i5/OS PASE descriptor to an ILE number. This is useful if your i5/OS PASE application needs to do file operations for an ILE descriptor that was not created by i5/OS PASE.

An i5/OS system-unique extension to the fstatx() function, STX_XPFFD_PASE, allows an i5/OS PASE program to determine the integrated file system descriptor number for an i5/OS PASE file descriptor. Special values (negative numbers) are returned for any i5/OS PASE descriptor attached to ILE C runtime support for files stdin, stdout, and stderr.

If the ILE environment variable QIBM_USE_DESCRIPTOR_STDIO is set to Y or I when the Qp2RunPase() API is called, i5/OS PASE synchronizes file descriptors 0, 1, and 2 with the integrated file system so that both i5/OS PASE and ILE C programs use the same descriptor numbers for files stdin, stdout, and stderr. When operating in this mode, if either i5/OS PASE code or ILE C code closes or reopens file descriptor 0, 1, or 2, the change affects stdin, stdout, and stderr processing for both environments.

i5/OS PASE run time generally does no character encoding conversion for data read or written through i5/OS PASE file descriptors (including sockets), except that ASCII-to-EBCDIC conversion is done (between the i5/OS PASE CCSID and job default CCSID) for data read from ILE C stdin or written to ILE C stdout and stderr.

Two environment variables control the automatic translation of stdin, stdout, and stderr:

ASCII-to-EBCDIC conversion for i5/OS PASE stdin, stdout, and stderr is disabled if the ILE environment variable QIBM_USE_DESCRIPTOR_STDIO is set to Y and QIBM_PASE_DESCRIPTOR_STDIO is set to B (allowing binary data to be read from stdin and written to stdout or stderr). The default for QIBM_PASE_DESCRIPTOR_STDIO is T for text. This value causes translation of EBCDIC to ASCII.

Related concepts
Data encoding
Related information
Integrated file system