IBM AS/400 Frozen Dessert Maker User Manual


 
Multiple-Device Files
operations. See the sections on inviting a program device in
ICF Programming
manual and
Data Management
manual.
The READ operation either processes a read-from-invited-program-devices
operation or a read-from-one-program-device operation. When no NEXT opera-
tion is in effect, a program-cycle-read or READ-by-file-name operation waits for
input from any of the devices that have been invited to respond (read-from-
invited-program-device). Other input and output operations, including a
READ-by-file-name after a NEXT operation, and a READ-by-format-name,
process a read-from-one-program-device operation using the program device
indicated in a special field. (The field is named in the DEVID keyword of the file
description specification lines.)
This device may be the device used on the last input operation, a device you
specify, or the requesting program device. See the sections on reading from
invited program devices and on reading from one program device in
ICF Pro-
gramming
manual and
Data Management
manual.
The NEXT operation specifies which device is to be used in the next
READ-by-file-name operation or program-cycle-read operation.
The POST operation puts information in the INFDS information data structure.
The information may be about a specific device or about the file. (The POST
operation is not restricted to use with multiple-device files.)
See the
ILE RPG for AS/400 Reference
for details of the RPG operation codes.
On the file description specification you can specify several keywords to control the
processing of multiple-device files.
The MAXDEV keyword indicates whether it is a single or multiple device file.
Specify MAXDEV(*FILE) to process a multiple device file with the maximum
number of devices taken from the definition of the file being processed.
Specify MAXDEV(*ONLY) to process only one device.
The DEVID keyword allows you to specify the name of a program device to
which input and output operations are directed.
When a read-from-one-program-device or WRITE operation is issued, the
device used for the operation is the device specified as the parameter to the
DEVID keyword. This field is initialized to blanks and is updated with the name
of the device from which the last successful input operation occurred. It can
also be set explicitly by moving a value to it. The ACQ operation code does not
affect the value of this field. If the DEVID keyword is not specified, the input
operation is performed against the device from which the last successful input
operation occurred. A blank device name is used if a read operation has not
yet been performed successfully from a device.
When a read-from-one-program device or WRITE operation is issued with a
blank device name, the RPG compiler implicitly uses the device name of the
requestor device for the program. If you call an RPG program interactively and
acquire an ICF device against which you want to perform one of these oper-
ations, you must explicitly move the device name of the ICF device into the
field name specified with the DEVID keyword prior to performing the operation.
If this is not done, the device name used will either be blank (in which case the
interactive requestor device name is used), or the device name used is the one
from the last successful input operation. Once you have performed an I/O oper-
Chapter 18. Using WORKSTN Files 343