OpenTP1 Version 7 Programming Reference C Language

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

dc_dam_rewrite - Update a logical file block

Format

ANSI C, C++

#include <dcdam.h>
int  dc_dam_rewrite (int damfd, struct DC_DAMKEY *keyptr,
                     int keyno, char *bufadr, int bufsize,
                     DCLONG flags)

K&R C

#include <dcdam.h>
int  dc_dam_rewrite (damfd, keyptr, keyno, bufadr, bufsize,
                     flags)
int       damfd;
struct DC_DAMKEY *keyptr;
int       keyno;
char      *bufadr;
int       bufsize;
DCLONG    flags;

Description

The function dc_dam_rewrite() outputs a block, input from the logical file for update processing, a block input by the function dc_dam_read(). It also cancels an update request. Block updating timing is shown below.

When multiple blocks are specified at a time and if even one of the specified blocks causes an error, processing is stopped and an error is returned. Update processing is not done in this case.

When updating a logical file block, specify the file descriptor which is the return value of the function dc_dam_open().

Arguments whose values are set in the UAP

damfd

Specify the file name with the file descriptor.

keyptr

Specify the address of the structure (DAM key) that indicates the block update range. For the structure, specify the block range with the first relative block number and the last relative block number. The structure format is as shown below.

struct DC_DAMKEY {
  int fstblkno;
  int endblkno;
  };

fstblkno
Specify the first relative block number of the block to be updated.

endblkno
Specify the last relative block number of the block to be updated. If 0 is specified, only the block of the relative block number specified for fstblkno is updated.

keyno

Specify the number of structures (number of structure arrays) to be set for keyptr.

bufadr

Specify the address of the update data.

bufsize

Specify the length of the update data. The length must be (block length to be updated x number of blocks to be updated). You can specify a value in the range from 504 to 2147483647.

flags

Specify one of the following values as the update request type:

DCDAM_UPDATE
Update request

DCDAM_CANCEL
Cancellation of update request

Return values

Return value Return value (numeric) Explanation
DC_OK 0 All blocks were updated normally.
DCDAMER_PROTO -1600 The function dc_rpc_open() is not called.
The function dc_dam_rewrite() is called outside the transaction range. (This value is returned only when a recoverable DAM file is accessed.)
N is specified for atomic_update in the user service definition. (This value is returned only when a recoverable DAM file is accessed.)
The function dc_dam_start() is not called. (This value is returned only when an unrecoverable DAM file is accessed.)
The UAP is incorrectly linked as follows:
  • The library (-1tdam) to be used for access to a TAM file using a DAM service function is linked incorrectly.
  • The definition of the resource manager for transaction control object files is incorrect.
DCDAMER_BADF -1603 The file descriptor specified for damfd is not the one which was acquired by opening the file normally, or the specified file is not open.
DCDAMER_BUFER -1604 The update data length (block length to be updated x number of blocks to be updated) is too short.
The value specified for the update data length is outside the range of values that can be specified.
DCDAMER_SEQER -1605 The function dc_dam_read() for update processing was not called.
DCDAMER_BNOER -1606 The relative block number is invalid.
DCDAMER_NOMEM -1607 The memory became insufficient.
DCDAMER_PARAM_KEYNO -1609 The value specified for keyno is smaller than 1.
DCDAMER_PARAM_FLAGS -1611 The value specified for flags is invalid.
DCDAMER_IOER -1620 An output error occurred. (This value is returned only when an unrecoverable DAM file is accessed.)
DCDAMER_JNLOV -1613 The number of block updates exceeded the maximum number of blocks that can be updated during one transaction according to the DAM service definition.
DCDAMER_LHOLD -1621 The file specified for damfd is in logical shutdown state.
DCDAMER_OHOLD -1622 The file specified for damfd is in shutdown state due to an error.
DCDAMER_TMERR -1629 An error occurred in the transaction service.
DCDAMER_BUFOV -1641 The update data length (block length to be updated x number of blocks to be updated) is too long.