IBM AS/400 Frozen Dessert Maker User Manual


 
Associating Files with Input/Output Devices
Chapter 14. Defining Files
Files serve as the connecting link between a program and the device used for I/O.
Each file on the system has an associated file description which describes the file
characteristics and how the data associated with the file is organized into records
and fields.
In order for a program to perform any I/O operations, it must identify the file
description(s) the program is referencing, what type of I/O device is being used,
and how the data is organized. This chapter provides general information on:
Associating file descriptions with input/output devices
Defining externally described files
Defining program-described files
Data management operations
Information on how to use externally and program-described files with different
device types is found in subsequent chapters.
Associating Files with Input/Output Devices
The key element for all I/O operations on the AS/400 is the file. The system sup-
ports the following file types:
database files
allow storage of data permanently on system
device files
allow access to externally attached devices. Include display files, printer
files, tape files, diskette files, and ICF files.
save files
used to store saved data on disk
DDM files
allow access to data files stored on remote systems.
Each I/O device has a corresponding file description of one of the above types
which the program uses to access that device. The actual device association is
made when the file is processed: the data is read from or written to the device
when the file is used for processing.
RPG also allows access to files and devices not directly supported by the system,
through the use of SPECIAL files. With a SPECIAL file, you must provide a
program that handles the association of the name to the file, and the data manage-
ment for the file. With other types of files, this is handled by RPG and the operating
system.
To indicate to the operating system which file description(s) your program will use,
you specify a
file name
in positions 7 through 16 of a file description specification
for each file used. In positions 36 through 42 you specify an RPG
device name
.
The device name defines which RPG operations can be used with the associated
file. The device name can be one of: DISK, PRINTER, WORKSTN, SEQ, or
Copyright IBM Corp. 1994, 1999 261