OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

dc_tam_open - Open a TAM table

Format

ANSI C, C++

#include <dctam.h>
DCLONG dc_tam_open (char *tblname, DCLONG flags)

K&R C

#include <dctam.h>
DCLONG dc_tam_open (tblname, flags)
char      *tblname;
DCLONG    flags;

Description

The function dc_tam_open() opens a TAM table. The function dc_tam_open() can be called both outside and inside the transaction.

If the function dc_tam_open() is called inside the transaction and lock in tables is specified as a lock type, lock in tables is enabled with lock for update processing.

If the function dc_tam_open() returns with an error, all the resources acquired within this function are released, and the status before this function was called is regained.

Arguments whose values are set in the UAP

tblname

Specify the name of the TAM table to be opened. The TAM table name can be specified with up to 32 characters. The character string must end with a null character.

flags

Specify whether to enable lock in tables or in records in the format shown below.

[{DCTAM_TBL_EXCLUSIVE[|{DCTAM_WAIT|DCTAM_NOWAIT}]|
DCTAM_REC_EXCLUSIVE}]

The default is DCTAM_REC_EXCLUSIVE.

DCTAM_TBL_EXCLUSIVE
Lock in tables

DCTAM_REC_EXCLUSIVE
Lock in records

The default is DCTAM_NOWAIT.

DCTAM_WAIT
The function waits for the resource to be released from lock.

DCTAM_NOWAIT
The function does not wait for the resource to be released from lock, and returns with an error

The table below shows the correspondence between flag values specified for flags and the specified type of lock.

Flag 1#1 Flag 2#2 Lock specified for flags
TBL_EXCLUSIVE WAIT Lock in tables, and waiting for release from lock if a lock error occurs
NOWAIT Lock in tables, and error return if a lock error occurs
REC_EXCLUSIVE N/A Lock in records

Legend:
N/A: Cannot be specified.

#1: The default is REC_EXCLUSIVE.

#2: The default is NOWAIT.

Return values

Return value Return value (numeric) Explanation
Positive integer The positive integer indicates the table descriptor.
DCTAMER_PARAM_TBL -1701 The value specified for tblname is invalid.
DCTAMER_PARAM_FLG -1708 The value specified for flags is invalid.
DCTAMER_NOTTAM -1709 The table specified for tblname is not a TAM table.
DCTAMER_UNDEF -1710 The TAM table has not been defined.
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_NOLOAD -1724 The TAM table was not loaded.
DCTAMER_OPENED -1725 The TAM table is 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_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_TAMVR -1762 The version of the TAM library linked to the UAP does not allow the UAP to operate with the current TAM service.
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 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_NO_ACL -1772 A TAM file to be opened is protected with the security facility. There is no ACL for the corresponding file.