IBM AS/400 Frozen Dessert Maker User Manual


 
Using SPECIAL Files
Example of Specifying a Sequential File
Figure 162 shows an example of how to specify a SEQ file in an ILE RPG source
member.
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+ ...*
FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++
FTIMECDS IP E DISK
FPAYOTIME O F 132 SEQ
*
Figure 162. SEQ Device
A SEQ device is specified for the PAYOTIME file. When the program is run, you
can use a OS/400 override command to specify the actual device (such as printer,
tape, or diskette) to be associated with the file while the program is running. For
example, diskette can be specified for some program runs while printer can be
specified for others. The file description, pointed to by the file name, can specify the
actual device, in which case an override command need not be used.
Using SPECIAL Files
The RPG device name SPECIAL (positions 36 - 42 of the file description specifica-
tions) allows you to specify an input and/or output device that is not directly sup-
ported by the ILE RPG operations. The input and output operations for the file are
controlled by a user-written routine. The name of the user-written routine, must be
identified in the file description specifications using the keyword
PGMNAME('
program name
').
ILE RPG calls this user-written routine to open the file, read and write the records,
and close the file. ILE RPG also creates a parameter list for use by the user-written
routine. The parameter list contains:
option code parameter (option)
return status parameter (status)
error-found parameter (error)
record area parameter (area).
This parameter list is accessed by the ILE RPG compiler and by the user-written
routine; it cannot be accessed by the program that contains the SPECIAL file.
The following describes the parameters in this RPG-created parameter list:
Option The option parameter is a one-position character field that indicates the
action the user-written routine is to process. Depending on the operation
being processed on the SPECIAL file (OPEN, CLOSE, FEOD, READ,
WRITE, DELETE, UPDATE), one of the following values is passed to
the user-written routine from ILE RPG:
Value Passed Description
O Open the file.
C Close the file.
F Force the end of file.
Chapter 17. Accessing Externally Attached Devices 327