OpenTP1 Version 7 Programming Reference C Language
dc_tam_write - Update/add a TAM table record
Format
ANSI C, C++
#include <dctam.h> int dc_tam_write (DCLONG tblid, struct DC_TAMKEY *keyadr, int keyno, char *datadr, int datsize, DCLONG flags) |
K&R C
#include <dctam.h> int dc_tam_write (tblid, keyadr, keyno, datadr, datsize, flags) DCLONG tblid; struct DC_TAMKEY *keyadr; int keyno; char *datadr; int datsize; DCLONG flags; |
Description
The function dc_tam_write() updates/adds a record indicated with a key value in/to a TAM table.
If a TAM table is open under lock in records, the following lock is enabled:
If the function dc_tam_write() returns with an error, all the resources specified within this function are released, and the status before this function was called is regained. However, if a TAM table which was acquired under lock for reference processing before this function was called is updated/added, lock for update processing is enabled. (Lock for reference processing is not regained.)
When a request is made to update/add multiple specified records, even if one of the records causes an error, the processing of all the records specified in this function results in an error.
The key value storage location in the data to be updated/added and the key area length are as specified in the tamcre command used for creation of a TAM table file.
The data part has a key value if the key value is assigned to the data part (the -s option not specified in the tamcre command) when a TAM table file is created. Therefore, an error is returned if the key value specified in the function dc_tam_write() is not found in the data to be updated/added. The data part has no key value if no key value is assigned to the data part (the -s option specified in the tamcre command). In this case, no check is made on the contents of the data to be updated/added.
Arguments whose values are set in the UAP
tblid
Specify the table descriptor of the TAM table whose record is to be updated/added. The table descriptor is the value returned with the function dc_tam_open().
keyadr
Specify the address of the structure having the address of the key value of the record to be updated/added. The structure format is as follows:
struct DC_TAMKEY { char *keyname; }; |
keyno
Specify the number of request records (number of structures specified for keyadr).
datadr
Specify the address of the data to be updated/added.
datsize
Specify the length of the data to be updated/added. The length of the data to be updated/added must be equal to or greater than (record length x number of request records).
flags
Specify in the format shown below the record access type and the lock release wait type when competition for a resource occurs:
{DCTAM_WRITE|DCTAM_WRTADD|DCTAM_ADD}[|{DCTAM_WAIT|DCTAM_NOWAIT}] |
Return values
Return value | Return value (numeric) | Explanation |
---|---|---|
DC_OK | 0 | The TAM table record was updated/added normally. |
DCTAMER_PARAM_TID | -1700 | The table descriptor specified for tblid is invalid. |
DCTAMER_PARAM_KEY | -1702 | The key value specified for keyadr is invalid. |
DCTAMER_PARAM_KNO | -1703 | The value specified for keyno is invalid. |
DCTAMER_PARAM_DTA | -1706 | The value specified for datadr is invalid. |
DCAMER_PARAM_DTS | -1707 | The data length specified for datsize is too short. |
DCTAMER_PARAM_FLG | -1708 | The value specified for flags is invalid. |
DCTAMER_NOTTAM | -1709 | The table specified for tblid is not a TAM table. |
DCTAMER_TAMEND | -1720 | The TAM service is being terminated. |
DCTAMER_PROTO | -1721 | The sequence of accessing the TAM table is invalid. |
The resource manager registration of the object file for transaction control having a linkage with the UAP is invalid. Alternatively, there is no linkage between the object file for transaction control and the UAP. |
||
atomic_update=N (nontransaction attribute) is specified in the user service definition of the UAP which called the function. | ||
DCTAMER_RMTBL | -1723 | The TAM table was deleted. |
DCTAMER_NOLOAD | -1724 | The TAM table was not loaded. |
DCTAMER_NOOPEN | -1726 | The TAM table is not open. |
DCTAMER_LOGHLD | -1727 | The TAM table is in logical shutdown state. |
DCTAMER_OBSHLD | -1728 | The TAM table is in shutdown state due to an error. |
DCTAMER_ACSATL | -1730 | Execution is impossible in the access mode of the TAM table specified in the TAM service definition. |
DCTAMER_NOREC | -1731 | The specified record does not exist. |
DCTAMER_EXKEY | -1735 | The record cannot be added because the key value specified for keyadr exists in the TAM table. |
DCTAMER_LOCK | -1736 | A lock error occurred. If DCTAM_WAIT is specified for flags, the resource could not be acquired because a timeout occurred (the wait time specified in the lock service definition was exceeded). |
DCTAMER_DLOCK | -1737 | A deadlock occurred. |
DCTAMER_TBLVR | -1760 | The version of the TAM library linked to the UAP does not allow the UAP to operate with the current TAM table. |
DCTAMER_FLSVR | -1761 | The version of the TAM library linked to the UAP does not allow the UAP to operate with the current OpenTP1 file service. |
DCTAMER_NOAREA | -1763 | The TAM table has no free record. |
DCTAMER_RECOBS | -1764 | The record has been damaged. |
DCTAMER_TRNNUM | -1765 | The number of transactions exceeds the maximum number of transactions which can be managed by the TAM service. |
DCTAMER_OPENNUM | -1766 | The number of open character special files exceeds the specified limit. |
DCTAMER_ACCESSS | -1767 | The access permission for special files has not been granted. |
DCTAMER_ACCESSF | -1768 | The access permission for TAM table files has not been granted. |
DCTAMER_MEMORY | -1769 | The memory became insufficient. |
DCTAMER_IO | -1770 | An input/output error occurred. |
DCTAMER_TMERR | -1771 | A transaction service error occurred. |
DCTAMER_ACCESS | -1773 | A TAM file to be accessed is protected with the security facility. The UAP that called the function dc_tam_write() has no access permission. |
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.