The RPG device name SPECIAL (positions 36 - 42 of the file description specifications) allows you to specify an input and/or output device that is not directly supported 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:
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:
You can add additional parameters to the RPG-created parameter list. Specify the keyword PLIST(parameter list name) on the file description specifications for the SPECIAL file. See Figure 190. Then use the PLIST operation in the calculation specifications to define the additional parameters.
The user-written routine, specified by the keyword PGMNAME of the file description specifications for the SPECIAL file, must contain an entry parameter list that includes both the RPG-created parameters and the user-specified parameters.
If the SPECIAL file is specified as a primary file, the user-specified parameters must be initialized before the first primary read. You can initialize these parameters with a factor 2 entry on the PARM statements or by the specification of a compile-time array or an array element as a parameter.
Table 54 shows the file operation codes that are valid for a SPECIAL file.
File Description Specifications Positions | Calculation Specifications Positions | |
---|---|---|
17 | 18 | 26-35 |
I | P/S | CLOSE, FEOD |
C | P/S | WRITE, CLOSE, FEOD |
U | P/S | UPDATE, DELETE, CLOSE, FEOD |
O | WRITE, OPEN, CLOSE, FEOD | |
I | F | READ, OPEN, CLOSE, FEOD |
C | F | READ, WRITE, OPEN, CLOSE, FEOD |
U | F | READ, UPDATE, DELETE, OPEN, CLOSE, FEOD |