|
| 1 | +# INDEXED File Locking Specification |
| 2 | + |
| 3 | +## LOCK MODE in the SELECT Statement |
| 4 | + |
| 5 | +- The SELECT statement's LOCK MODE can only specify AUTOMATIC or MANUAL. |
| 6 | +- When omitted, the default value for LOCK MODE is MANUAL |
| 7 | + - When `-lock-mode-automatic` is specified at compile time, the default value for omitted LOCK MODE becomes AUTOMATIC. |
| 8 | + |
| 9 | +## Record Locking Behavior |
| 10 | + |
| 11 | +- When a file is opened with OPEN I-O and a READ statement without WITH NO LOCK or WITH LOCK is executed: |
| 12 | + - If the SELECT statement's LOCK MODE is MANUAL, the record is not locked |
| 13 | + - If the SELECT statement's LOCK MODE is AUTOMATIC, the record is locked |
| 14 | +- When a file is opened with OPEN I-O and a READ statement with WITH LOCK is executed, the record is locked |
| 15 | +- When a file is opened with OPEN I-O and a READ statement with WITH NO LOCK is executed, the record is not locked |
| 16 | +- When processing fails due to record locking, the file status becomes 51 |
| 17 | + |
| 18 | +## File Locking Behavior |
| 19 | + |
| 20 | +- When a file is opened with OPEN OUTPUT, a file lock is applied to the file |
| 21 | +- When processing fails due to file locking, the file status becomes 61 |
| 22 | + |
| 23 | +## Migrating Legacy INDEXED Files to the New Version |
| 24 | + |
| 25 | +Legacy INDEXED files cannot be used directly with the new version of opensource COBOL 4J. |
| 26 | +To convert INDEXED files created with legacy versions to be compatible with the new version, please use the following command: |
| 27 | + |
| 28 | +```sh |
| 29 | +cobj-idx migrate <<INDEXED_FILE>> |
| 30 | +``` |
| 31 | +
|
| 32 | +This command converts the specified INDEXED file to be compatible with the new version. |
| 33 | +
|
| 34 | +## Unlocking INDEXED Files |
| 35 | +
|
| 36 | +The following command can release all file locks and record locks on an INDEXED file: |
| 37 | +
|
| 38 | +```sh |
| 39 | +cobj-idx unlock <<INDEXED_FILE>> |
| 40 | +``` |
| 41 | +
|
| 42 | +## Behavior When Opening Legacy INDEXED Files |
| 43 | +
|
| 44 | +When attempting to open legacy INDEXED files, the file status becomes 92. |
0 commit comments