An entry of ADD is valid for input, output, or update files. DEL is valid for update DISK files only. When ADD is specified, there must be an A in position 20 of the corresponding file-description specification.
If positions 18-20 are blank, then for an output file, the record will be added; for an update file, the record is updated.
The Record-Addition/Deletion entry must appear on the same line that contains the record type (H, D, T, E) specification (position 17). If an AND/OR line is used following an ADD or DEL entry, this entry applies to the AND/OR line also.
| Function | Specification | |||
|---|---|---|---|---|
| Free-form USAGE keyword | Fixed-form File Description | Output | ||
| Position 17 | Position 20 | Positions 18-20 | ||
| Create new file1 |
USAGE(*OUTPUT) | O |
Blank |
Blank |
| Process file | USAGE(*INPUT) | I | Blank | Blank |
| Process file and add records to the existing file | USAGE(*INPUT : *OUPUT) | I | A | ADD |
| Process file and update the records (update or delete) | USAGE(*OUTPUT) or USAGE(*DELETE) | U | Blank | Blank |
| Process file and add new records to an existing file | USAGE(*UPDATE : *OUTPUT) | U | A | ADD |
| Process file and delete an existing record from the file | USAGE(*DELETE : *OUTPUT) | U | Blank | DEL |
| Note: Within
RPG, the term create a new file means to add records to a newly
created file. Thus, the first two entries in this table perform the
identical function. Both are listed to show that there are two ways
to specify that function.
|
||||