OpenTP1 Version 7 Programming Guide
If another UAP starts TAM table update processing while a TAM file is being updated, the results of both update processing are concurrently reflected into one record. Consequently, the table contents include conflicting information. To prevent this problem, specify lock in the function to access the TAM file. Specifying lock ensures that the data items accessed from UAPs match each other.
Lock for DAM files is managed in global transactions.
Lock conditions for accessing TAM tables are called lock modes. The following lock modes are available:
Lock can be specified in units of records or tables when a TAM table is accessed in online mode as explained below.
Lock is enabled in records. When a record is input for reference processing, specify whether to enable lock for reference or not (other UAPs allowed to do update processing). When a record is input or updated for update processing, specify lock for update. The acquired lock is reset when the transaction that specified processing for the TAM table terminates normally.
Lock is enabled in tables. When a TAM table is opened under tables-based lock or when a record is added/deleted, specify lock for update for the entire TAM table. The acquired lock is reset when the transaction that specified processing for the TAM table terminates normally. If tables are opened before a transaction is started, tables-based lock cannot be specified for the tables.
If an attempt is made to access a TAM table which is locked by another UAP (lock error), the function for this access will return with an error or wait until the TAM table is unlocked. This can be specified in the argument to the function.
If wait until unlocking is specified and a deadlock or timeout occurs, deadlock information will be output after the function waiting for an unlocked TAM table returns with an error. If the function returns with a deadlock or timeout error, acquire the synchronization point of the transaction and free all the acquired resources.
For UAPs written in COBOL, use either of the following methods to specify whether the function for access will wait until the TAM table is unlocked:
See the manuals OpenTP1 System Definition and OpenTP1 Programming Reference COBOL Language on how to specify for COBOL UAPs whether the function for access will wait until the resource is unlocked.
The table below indicates how lock specifications in TAM service functions are related to actual lock statuses. UAPs written in COBOL lock or unlock resources by using API functions for record access.
Table 4-9 Lock specifications in TAM service functions and actual lock statuses
Value assigned to flags on TAM service function | TAM table lock | TAM record lock | ||
---|---|---|---|---|
dc_tam_open | Table-based lock | Update lock | --#1 | |
Record-based lock | A record is locked using a function for access to the record. | |||
dc_tam_read | For referencing | No lock | -- | -- |
Lock possible | Lock for referencing#2 | Lock for referencing | ||
For update | Lock for referencing#2 | Update lock | ||
dc_tam_rewrite | Lock for referencing#3 | Update lock#3 | ||
dc_tam_write | For update | Lock for referencing#2 | Update lock | |
Either for update or addition or for addition | Update lock | --#1 | ||
dc_dam_delete | Update lock | --#1 |
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.