OpenTP1 Version 7 Programming Reference C Language

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

dc_tam_delete - Delete a TAM table record

Format

ANSI C, C++

#include <dctam.h>
int  dc_tam_delete (DCLONG tblid, struct DC_TAMKEY *keyadr,
                    int keyno, char *bufadr, int bufsize,
                    DCLONG flags)

K&R C

#include <dctam.h>
int       dc_tam_delete (tblid, keyadr, keyno, bufadr, bufsize,
                    flags)
DCLONG     tblid;
struct  DC_TAMKEY *keyadr;
int        keyno;
char       *bufadr;
int        bufsize;
DCLONG     flags;

Description

The function dc_tam_delete() deletes a record indicated as a key value from a TAM table. The record to be deleted can be saved in the buffer. However, if the function dc_tam_delete() returns with an error, the buffer contents cannot be ensured.

If a TAM table is open under lock in records, lock in tables can be enabled with lock for update processing.

If the function dc_tam_delete() returns with an error, all the resources specified in this function are released, and the status before this function was called is regained. However, if an attempt is made to delete a TAM table which was acquired under lock for reference processing before this function was called, lock for update processing is enabled. (Lock for reference processing is not regained.)

Note the following when multiple records are specified for deletion:

Arguments whose values are set in the UAP

tblid

Specify the table descriptor of the TAM table from which a record is deleted. This descriptor is the return value of the function dc_tam_open().

keyadr

Specify the address of the structure having the key value address of the record to be deleted. The structure format is as follows:

struct DC_TAMKEY {
                  char *keyname;
                  };

keyno

Specify the number of request records (number of structures specified for keyadr).

bufadr

If the record to be deleted is saved in the buffer, specify the buffer address. If DCTAM_NOOUTREC (the record to be deleted is not saved) is specified for flags, the specification for this argument is invalidated.

bufsize

If the record to be deleted is saved in the buffer, specify the length of the buffer. The return buffer length must be equal to or greater than (record length x number of request records). If DCTAM_NOOUTREC (the record to be deleted is not saved) is specified for flags, the specification for this argument is invalidated.

flags

Specify the following items in the format shown below:

Return values

Return value Return value (numeric) Explanation
DC_OK 0 The record was deleted from the TAM table normally.
DCTAMER_PARAM_TID -1700 The table identifier 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_BFA -1704 The value specified for bufadr is invalid.
DCTAMER_PARAM_BFS -1705 The buffer length specified for bufsize 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_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_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_ACCESS -1773 The TAM file to be accessed is protected with the security facility. The UAP that called the function dc_tam_delete() has no access permission.

Notes

To delete all records stored in the hash format TAM table:

  1. Save the key value of the record found by first retrieval as variable-1.
  2. Using the key value of variable-1, execute a NEXT retrieval.
  3. Save the key value of the record found in step 2 as variable-2.
  4. Delete the key value record that was saved as variable-1.
  5. Save the key value of variable-2 as variable-1.
  6. Repeat steps 2 to 5 until step 2 encounters an error (NEXT retrieval).
  7. After step 2 has encountered an error, delete the key value record that was last saved as variable-1.

Note that when you delete all records, performing the following steps may exert a high load on the CPU.

  1. Execute a first retrieval of records.
  2. Delete the record found in step 1.
  3. Repeat step 1 and step 2 (that is, continue executing a first retrieval of records and deleting the record found).