Stream file

 

A stream file is a randomly accessible sequence of bytes, with no further structure imposed by the system.

The integrated file system provides support for storing and operating on information in the form of stream files. Documents that are stored in your system's folders are stream files. Other examples of stream files are PC files and the files in UNIX® systems. An integrated file system stream file is a system object that has an object type of *STMF.

To better understand stream files, it is useful to compare them with i5/OS® database files. A database file is record-oriented; it has predefined subdivisions that consist of one or more fields that have specific characteristics, such as length and data type. Figure 1. Comparison of a stream file and a record-oriented file

Comparison of a stream file and record-oriented file

Stream files and record-oriented files are structured differently, and this difference in structure affects how the files are used. The structure affects how an application is written to interact with the files and where each type of file is best used in an application. A record-oriented file, for example, is well suited for storing customer statistics such as name, address, and account balance. A record-oriented file allows these predefined fields to be individually accessed and manipulated, using the extensive programming facilities of your system. But a stream file is better suited for storing information, such as a customer's picture, which is composed of a continuous string of bits representing variations in color. Stream files are particularly well suited for storing strings of data, such as the text of a document, images, audio, and video. A file has one of two format options: *TYPE1 stream file or *TYPE2 stream file. The file format depends on the release the file was created on, or if a file was created in a user-defined file system, the value that was specified for that file system.

The concept of *TYPE1 and *TYPE2 stream files is different from the concept of *TYPE1 and *TYPE2 directory formats. One does not relate to the other.

 

*TYPE1 stream files

A *TYPE1 stream file has the same format as stream files created on releases before OS/400® V4R4.

A *TYPE1 stream file has a minimum size of 4096 bytes and a maximum object size of approximately 128 GB (1 GB equals approximately 1 073 741 824 bytes).

 

*TYPE2 stream files

A *TYPE2 stream file has high-performance file access.

*TYPE2 stream files have a maximum object size of approximately 1 TB (1 TB equals approximately 1 099 511 627 776 bytes) in the "root" (/), QOpenSys and user-defined file systems. Otherwise, the maximum is approximately 256 GB. It is also capable of memory mapping, as well as the ability to specify an attribute to optimize main storage allocation. All files created with OS/400 V4R4 and newer systems are *TYPE2 stream files, unless they were created in a user-defined file system that specified a file format of *TYPE1.

Any files larger than 256 GB cannot be saved or restored to systems before i5/OS V5R3.

 

Parent topic:

Integrated file system concepts