Before a file can be processed, it must be opened using an OPEN macro. The following open modes are permitted for ISAM files: OUTPUT, OUTIN, EXTEND, INOUT, INPUT. At the same time, it is necessary to check whether the file has already been opened by another job, in which ISAM pool it is to be processed, whether it is to be processed in locate or move mode, etc. The table below provides an overview of the open modes.
OPEN mode | Brief description |
---|---|
OUTPUT | A new file is created sequentially and only the PUT macro may be used. If an ISAM file with the specified name already exists, it is overwritten and the catalog entry is updated. |
OUTIN | As for OPEN OUTPUT, a new file is created and any existing file is overwritten. All ISAM actions are permitted. |
EXTEND | An existing file is extended sequentially; as for OPEN OUTPUT only write operationswith PUT are permitted. |
INOUT | An existing file is to be updated: as for OUTIN, all ISAM actions (such as finding, reading, updating, inserting and deleting records) are permitted. |
INPUT | An existing file is to be read, i.e. only read operations are permitted. |
File locks
If a file is not opened for shared-update processing, the OPEN mode determines whether other jobs may work concurrently with this file. If a file is opened in any mode other than INPUT, it is locked for all other jobs; if it is opened in INPUT mode, other jobs may also open it with OPEN INPUT.
Storage space allocation
The minimum space allocation must make allowance for the fact that there is always at least one data block and one index block and, for NK-ISAM files, one control block. This means, for BLKSIZE=(STD,n), that the primary allocation for NK-ISAM files must always be at least n + 2 PAM pages, while n + 1 PAM pages are sufficient for a K-ISAM file. Since no secondary allocation can be made when a file is opened, an OPEN error will result if insufficient space is allocated. (For further details of the primary allocation, see section "Requesting storage space".)
Operating modes
ISAM files are normally processed in move mode. File processing in locate mode is still supported for NK-ISAM, but only for reasons of compatibility.
Action macro | OPEN type | ||||
---|---|---|---|---|---|
INPUT | OUTPUT | EXTEND | INOUT | OUTIN | |
GET | B | - | - | B | B |
GETR | B | - | - | B | B |
GETFL | B | - | - | B | B |
GETKY | B | - | - | B | B |
PUT | - | B | B | B | B |
PUTX | - | - | - | B | B |
INSRT | - | - | - | M | M |
STORE | - | - | - | M | M |
ELIM | - | - | - | x | x |
SETL | x | - | - | x | x |
B: | Move mode or locate mode permitted. |
M: | Move mode (locate mode only if a work area is supplied). |
x: | Action macro may be used. |
- | Action macro may not be used. |