OpenTP1 Version 7 Programming Reference C Language
dc_dam_write - Output a logical file block
Format
ANSI C, C++
#include <dcdam.h> int dc_dam_write (int damfd, struct DC_DAMKEY *keyptr, int keyno, char *bufadr, int bufsize, DCLONG flags) |
K&R C
#include <dcdam.h> int dc_dam_write (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_write() outputs a specified block. The block output timing is given below.
When a request is made to output multiple blocks at a time and if even one of the specified blocks causes an error, processing is stopped and an error is returned. The blocks are not output in this case.
When outputting 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 descriptor of the file to which a block is output.
keyptr
Specify the address of the structure (DAM key) that indicates the block output 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; }; |
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 output data. The length must be (block length to be output x number of blocks to be output). You can specify a value in the range from 504 to 2147483647.
flags
Specify whether the function is to wait for the resource to be released from lock if a lock error occurs.
DCDAM_WAIT: The function waits for the resource to be released from lock.
DCDAM_NOWAIT: The function does not wait for the resource to be released from lock, and returns with an error.
DCNOFLAGS: Processing is done according to the value specified for flags of the function dc_dam_open().
If DCNOFLAGS is specified, the subsequent processing is as follows:
If the function dc_dam_open() in which the file descriptor is specified for damfd specifies files-based lock as the type of lock, the value specified for this option is meaningless.
Return values
Return value | Return value (numeric) | Explanation |
---|---|---|
DC_OK | 0 | All blocks were output normally. |
DCDAMER_PROTO | -1600 | The function dc_rpc_open() is not called. |
The function dc_dam_write() 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:
|
||
DCDAMER_EXCER | -1602 | A lock specification error occurred. |
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 has not been defined. |
DCDAMER_BUFER | -1604 | The output data length (block length to be output x number of blocks to be output) is too short. |
The value specified for the output data length is outside the range of values that can be specified. | ||
DCDAMER_SEQER | -1605 | The call sequence of functions is invalid. |
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_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. (Returned only when a recoverable DAM file is accessed). |
DCDAMER_IOER | -1620 | An output error occurred. (This value is returned only when an unrecoverable DAM file is accessed.) |
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_ACCESS | -1628 | A DAM file to be accessed is protected with the security facility. The UAP that called the function dc_dam_write() has no access permission. |
DCDAMER_TMERR | -1629 | An error occurred in the transaction service. (This value is returned only when a recoverable DAM file is accessed.) |
DCDAMER_BUFOV | -1641 | The output data length (block length to be output x number of blocks to be output) is too long. |
DCDAMER_DLOCK | -1642 | A deadlock occurred. |
DCDAMER_TIMOUT | -1643 | The resource could not be acquired because a timeout occurred (the wait time specified in the lock service definition was exceeded). |
DCDAMER_LCKOV | -1645 | The number of lock requests exceeds the specified maximum number of concurrent lock requests. |
DCDAMER_ACSOV | -1648 | The maximum number of blocks that can be accessed is exceeded. (This value is returned only when an unrecoverable DAM file is accessed.) |
Note
Do the following if the values DCDAMER_JNLOV and DCDAMER_ACSOV are returned:
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.