You can write records to a diskette file.
A diskette file is a device file that is used for a diskette unit. The object type is *FILE. The Tape and Diskette Device Programming manual contains information on diskette files.
I/O Considerations for Diskette Files
A diskette unit can only be accessed with a program described file. An ILE C/C++ program can only process a diskette file sequentially. The concept of clearing a file or opening a file using append mode does not apply to diskette files.
The diskette file label name is required when the file is opened. You specify this label name using the Override Diskette File (OVRDKTF) command. If the diskette file is opened for input and:
Note: Output may not always result in an I/O operation to a diskette file. The I/O buffer must contain enough data to fill an entire track on a diskette. When opening a diskette file for output, any files existing on the diskette are deleted if the data file expiration date is less than or equal to the system date.
Opening Diskette Files as Binary Stream Files
To open an iSeries diskette file as a binary stream file for record-at-a-time processing, use the fopen() function with one of the following modes:
Note: The only way to create a diskette file is to use the CRTDKTF command. If you use fopen() and the diskette file does not exist, a physical database file is created.
The valid keyword parameters are:
•type •lrecl •blksize
I/O Considerations for Binary Stream Diskette Files
Blocking Binary Stream Diskette Files: If your program processes diskette files, performance can be improved if I/O operations are blocked. If you do not specify a value for the blksize parameter or if you specify blksize=0 on fopen(), the system calculates a number of records to be transferred as a block to your program.
Binary Stream Functions for Diskette Files
Use the following binary stream functions to process diskette files:
Opening Diskette Files as Record Files
To open an iSeries diskette file as a record file, use the _Ropen() function with one of the following modes:
The valid keyword parameters are:
•blkrcd •lrecl •secure •riofb
I/O Considerations for Record Diskette Files
The _Rfeod() function is valid for diskette record files opened for input and output operations. It signals the end-of-file. For output operations, it does not write any data.
Read and Write Record Diskette Files: If you read from a diskette file, the next sequential record in the diskette file is processed. Use the _Rreadn() function for reading diskette files and the _Rwrite() function for writing to diskette files.
Blocking Record Diskette Files: If your program processes diskette files, performance can be improved if records are blocked. If you specify blkrcd=Y on _Ropen(), the system calculates a number of records to be transferred as a block to your program.
Record Functions for Diskette Files
Use the following record functions to process diskette files:
The following example shows how to write to a diskette file.
To create the physical file T1520DDI using the following DDS source:
A R CUST
A NAME 20A
A AGE 3B
A DENTAL 6B
Dave Bolt 35 350
Mary Smith 54 444
Mike Tomas 25 545
Alex Michaels 32 512
T1520DSK — ILE C Source to Write Records to a Diskette File
The _Ropen() function opens the diskette file T1520DKF and the database file T1520DDI. The _Rreadn() function reads all database records. The _Rwrite() function copies all database records that have a value > 400 in the dental field to the diskette file T1520DKF.
The output to the diskette file is as follows:Mary Smith 444
After you run the program, the diskette file contains only the records that satisfied the selection criteria
IBM-ILE Related Interview Questions
|IBM - RPG Interview Questions||IBM DB2 Interview Questions|
|DB2 Using SQL Interview Questions||IBM Mainframe Interview Questions|
|IBM AIX 7 Administration Interview Questions||AS400 Interview Questions|
|Automatic Storage Management (ASM) Interview Questions||Mainframe DB2 Interview Questions|
|Rpgle Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.