Valid File Operations

Table 47 shows the valid file operation codes allowed for DISK files processed by keys and Table 48 for DISK files processed by non-keyed methods. The operations shown in these figures are valid for externally described DISK files and program-described DISK files.

Before running your program, you can override a file to another file. In particular, you can override a sequential file in your program to an externally described, keyed file. (The file is processed as a sequential file.) You can also override a keyed file in your program to another keyed file, providing the key fields are compatible. For example, the overriding file must not have a shorter key field than you specified in your program.

Note:
When a database record is deleted, the physical record is marked as deleted. Deleted records can occur in a file if the file has been initialized with deleted records using the Initialize Physical File Member (INZPFM) command. Once a record is deleted, it cannot be read. However, you can use the relative record-number to position to the record and then write over its contents.
Table 47. Valid File Operations for Keyed Processing Methods (Random by Key, Sequential by Key, Sequential within Limits)
File-Description
Specifications Positions
Calculation Specifications Positions
17 18 20 281 342 26-35
I P/S
K/A/P/G/
D/T/Z/F
CLOSE, FEOD, FORCE
I P/S A
K/A/P/G/
D/T/Z/F
WRITE, CLOSE, FEOD, FORCE
I P/S L
K/A/P/G/
D/T/Z/F
CLOSE, FEOD, FORCE
U P/S
K/A/P/G/
D/T/Z/F
UPDATE, DELETE, CLOSE, FEOD, FORCE
U P/S A
K/A/P/G/
D/T/Z/F
UPDATE, DELETE, WRITE, CLOSE, FEOD, FORCE
U P/S L
K/A/P/G/
D/T/Z/F
UPDATE, DELETE, CLOSE, FEOD, FORCE
I F
K/A/P/G/
D/T/Z/F
READ, READE, READPE, READP, SETLL, SETGT, CHAIN, OPEN, CLOSE, FEOD
I F A
K/A/P/G/
D/T/Z/F
WRITE, READ, READPE, READE, READP, SETLL, SETGT, CHAIN, OPEN, CLOSE, FEOD
I F L
K/A/P/G/
D/T/Z/F
READ, OPEN, CLOSE, FEOD
U F
K/A/P/G/
D/T/Z/F
READ, READE, READPE, READP, SETLL, SETGT, CHAIN, UPDATE, DELETE, OPEN, CLOSE, FEOD
U F A
K/A/P/G/
D/T/Z/F
WRITE, UPDATE, DELETE, READ, READE, READPE, READP, SETLL, SETGT, CHAIN, OPEN, CLOSE, FEOD
U F L
K/A/P/G/
D/T/Z/F
READ, UPDATE, DELETE, OPEN, CLOSE, FEOD
O Blank A
K/A/P/G/
D/T/Z/F
WRITE (add new records to a file), OPEN, CLOSE, FEOD
O Blank
K/A/P/G/
D/T/Z/F
WRITE (initial load of a new file)3, OPEN, CLOSE, FEOD
Notes:
  1. An L must be specified in position 28 to specify sequential-within-limits processing by a record-address file for an input or an update file.
  2. Externally described files require a K in position 34; program-described files require an A,P,G,D,T,Z, or F in position 34 and an I in position 35.
  3. An A in position 20 is not required for the initial loading of records into a new file. If A is specified in position 20, ADD must be specified on the output specifications. The file must have been created with the IBM i CREATE FILE command.
Table 48. Valid File Operations for Non-keyed Processing Methods (Sequential, Random by Relative Record Number, and Consecutive)
File-Description
Specifications Positions
Calculation Specifications Positions
17 18 20 34 44-80 26-35
I P/S   Blank   CLOSE, FEOD, FORCE
I P/S   Blank RECNO CLOSE, FEOD, FORCE
U P/S   Blank   UPDATE, DELETE, CLOSE, FEOD, FORCE
U P/S   Blank RECNO UPDATE, DELETE, CLOSE, FEOD, FORCE
I F   Blank   READ, READP, SETLL, SETGT, CHAIN, OPEN, CLOSE, FEOD
I F   Blank RECNO READ, READP, SETLL, SETGT,
U F   Blank   READ, READP, SETLL, SETGT, CHAIN, UPDATE, DELETE, OPEN, CLOSE, FEOD
U F   Blank RECNO READ, READP, SETLL, SETGT, CHAIN, UPDATE, DELETE, OPEN, CLOSE, FEOD
U F A Blank RECNO WRITE (overwrite a deleted record), READ, READP, SETLL, SETGT, CHAIN, UPDATE, DELETE, OPEN, CLOSE, FEOD
I R  
A/P/G/
D/T/Z/
F/
Blank1
  OPEN, CLOSE, FEOD
I R   Blank2   OPEN, CLOSE, FEOD
O Blank A Blank RECNO WRITE3 (add records to a file), OPEN, CLOSE, FEOD
O Blank   Blank RECNO WRITE4 (initial load of a new file), OPEN, CLOSE, FEOD
O Blank   Blank Blank WRITE (sequentially load or extend a file), OPEN, CLOSE, FEOD
Notes:
  1. If position 34 is blank for a record-address-limits file, the format of the keys in the record-address file is the same as the format of the keys in the file being processed.
  2. A record-address file containing relative record numbers requires a T in position 35.
  3. The RECNO field that contains the relative record number must be set prior to the WRITE operation or if ADD is specified on the output specifications.
  4. An A in position 20 is not required for the initial loading of the records into a new file; however, if A is specified in position 20, ADD must be specified on output specifications. The file must have been created with one of the IBM i file creation commands.


[ Top of Page | Previous Page | Next Page | Contents | Index ]