Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

PAM files

Like ISAM files, files with relative organization and FCBTYPE=PAM can also be updated simultaneously by several users if the ADD-FILE-LINK command contains SHARED-UPDATE=YES and the file was opened with OPEN I-O.

To ensure data consistency during shared updating, the COBOL2000 runtime system uses the locking and unlocking mechanism of the DMS access method UPAM. Unlike ISAM, access coordination in this case is file-specific. Accordingly, statements for a specific file have no impact on any other file.

As with ISAM, the lock affects not just one specific record in a block, but the entire block in which that record is contained (see section "Indexed file organization").

For PAM files, as with ISAM files, the format extension WITHNO LOCK may also be used in all formats of the READ or START statement provided SHARED-UPDATE=YES and OPEN I-O were specified for these files.

Rules for shared updating

  1. Reading and positioning with or without the WITH NO LOCK phrase is effected in the same manner as for ISAM files.

  2. Updating of records

    If a record is to be updated by a REWRITE or DELETE statement, the record must be read (as with ISAM files) immediately before this statement by means of a READ statement (without the WITH NO LOCK phrase). No other statement for this file must be executed between these statements. Unlike the conventions for ISAM files, statements for other PAM files are allowed (on account of the file-oriented access coordination).

  3. Waiting times in the event of a lock

    The maximum waiting time for the release of a locked block is 999 seconds. After this time has elapsed, control is transferred to the USE AFTER STANDARD ERROR procedure, if present, or the program is terminated with error message COB9151 (FILE STATUS 93 and DMS error code D9B0 or D9B1).

  4. Releasing a locked record

    The release of a locked block can be accomplished with the same statements as for ISAM files, but all statements must refer to the same file.

    In contrast to ISAM files, a statement for a PAM file does not release blocks of another PAM file.

Notes

  1. If a PAM file (with SHARED-UPDATE=YES, OPEN I-O) is to be processed in a program, a USE AFTER STANDARD ERROR procedure should be defined for this file (see “Indexed files”).

  2. Unlike ISAM files (with SHARED-UPDATE=YES, OPEN I-O), the simultaneous processing of two or more files (all with SHARED-UPDATE=YES, OPEN I-O), of which at least one is a PAM file, allows one record per user to be locked simultaneously in any number of files (but only one record in one file). This may result in a deadlock situation.

  3. As with ISAM files, any locks on records (blocks!) in PAM files should be released as soon as possible in order to minimize waiting times for other users.

Example 9-14

Deadlock

User A:

READ file1 (record n)
.
.
READ file2 (record m)

(Block in file1 not unlocked)

User B:

READ file2 (record m)
.
.
READ file1 (record n)

(Block in file2 not unlocked)

Both users are waiting for the particular block to be released (deadlock).

The maximum waiting time for the release of a locked block is 999 seconds. After this time has elapsed, the USE AFTER STANDARD ERROR procedure, if present, is activated or the program is terminated with error message COB9151 (FILE STATUS 93 and DMS error code D9B0 or D9B1).