Copying data between stream files and database files
If you are familiar with operating on database files using record-oriented facilities such as data description specifications (DDS), you might find some fundamental differences in the way you operate on stream files.
The differences result from the different structure (or perhaps lack of structure) of stream files in comparison with database files. To access data in a stream file, you indicate a byte offset and a length. To access data in a database file, you typically define the fields to be used and the number of records to be processed.
Because you define the format and characteristics of a record-oriented file ahead of time, the operating system has knowledge of the file and can help you avoid performing operations that are not appropriate for the file format and characteristics. With stream files, the operating system has little or no knowledge of the format of the file. The application must know what the file looks like and how to operate on it properly. Stream files allow an extremely flexible programming environment, but at the cost of having little or no help from the operating system. Stream files are better suited for some programming situations; record-oriented files are better suited for other programming situations.
- Copying data using CL commands
There are two sets of CL commands that allow you to copy data between stream files and database file members.
- Copying data using APIs
If you want to copy database file members to a stream file in an application, you can use the integrated file system open(), read(), and write() functions to open a member, read data from it, and write data to it or another file.
- Copying data using data-transfer functions
The date-transfer applications in the iSeries™ Access Family licensed program have the advantage of an easy-to-follow graphical interface, and automatic numeric and character data conversion.
Parent topic:
Programming support
Related concepts
Stream file