OpenTP1 Version 7 Programming Reference C Language
dc_dam_open - Open a logical file
Format
ANSI C, C++
#include <dcdam.h> int dc_dam_open (char *lfname, DCLONG flags) |
K&R C
#include <dcdam.h> int dc_dam_open (lfname, flags) char *lfname; DCLONG flags; |
Description
The function dc_dam_open() opens a logical file.
Arguments whose values are set in the UAP
lfname
Within 1 to 8 bytes, specify the name of a logical file to be opened.
flags
Specify the following items in the format below:
{DCDAM_FILE_EXCLUSIVE|DCDAM_BLOCK_EXCLUSIVE [|DCDAM_WAIT|DCDAM_NOWAIT|]} |
Setting flags
The value specified for flags depends on whether the DAM file is recoverable.
Flag 1 | Flag 2# | Lock Specified for Flags |
---|---|---|
FILE_EXCLUSIVE | -- | Files-based lock |
BLOCK_EXCLUSIVE | WAIT | Blocks-based lock, and waiting for release from lock if a lock error occurs |
NOWAIT | Blocks-based lock, and error return if a lock error occurs |
Flag 1 | Flag 2# | Lock Specified for Flags |
---|---|---|
FILE_EXCLUSIVE | WAIT | Files-based lock, and waiting for release from lock if a lock error occurs |
NOWAIT | Files-based lock, and error return if a lock error occurs | |
BLOCK_EXCLUSIVE | WAIT | Blocks-based lock, and waiting for release from lock if a lock error occurs |
NOWAIT | Blocks-based lock, and error return if a lock error occurs |
When files-based lock is specified for flag 1, no lock error occurs in the function dc_dam_read() or dc_dam_write() because all files are locked regardless of recoverable or unrecoverable files. Therefore, whether to wait for release from lock cannot be specified. The lock release wait type specified for the argument of the function dc_dam_read() or dc_dam_write() is ignored.
Return values
Return value | Return value (numeric) | Explanation |
---|---|---|
0 or positive integer | 0 or a positive integer indicates the file descriptor. | |
DCDAMER_PROTO | -1600 | The function dc_rpc_open() is not called. |
N is specified for atomic_update in the user service definition. (This value is returned only when a recoverable DAM file is accessed.) | ||
The dc_dam_start() function is not called when N is specified for the atomic_update operand in the user service definition. (This value is returned only when an unrecoverable DAM file is accessed.) | ||
The UAP is incorrectly linked as follows:
|
||
DAM file lock is specified from outside the transaction range. (This value is returned only when a recoverable DAM file is accessed.) | ||
File lock is specified for the DAM file in lock control for each global transaction. (This value is returned only when a recoverable DAM file is accessed.) | ||
DCDAMER_UNDEF | -1601 | The logical file name specified for lfname has not been defined. |
DCDAMER_EXCER | -1602 | A lock error occurred. |
DCDAMER_SEQER | -1605 | The dc_dam_start() function is not called when Y is specified for the atomic_update operand in the user service definition. (This value is returned only when an unrecoverable DAM file is accessed.) |
DCDAMER_NOMEM | -1607 | The memory became insufficient. |
DCDAMER_OPENED | -1608 | The logical file specified for lfname is open. |
DCDAMER_PARAM_LFNAME | -1610 | The value specified for the logical file name is invalid. |
DCDAMER_PARAM_FLAGS | -1611 | The value specified for flags is invalid. |
DCDAMER_LHOLD | -1621 | The file specified for lfname is in logical shutdown state. |
DCDAMER_OHOLD | -1622 | The file specified for lfname is in shutdown state due to an error. |
DCDAMER_OPENNUM | -1627 | The number of open character special files exceeds the specified limit. |
DCDAMER_ACCESS | -1628 | The access permission for character special files has not been granted. |
DCDAMER_TMERR | -1629 | An error occurred in the transaction service. (This value is returned only when a recoverable DAM file is accessed.) |
DCDAMER_DLOCK | -1642 | A deadlock occurred. (This value is returned only when an unrecoverable DAM file is accessed.) |
DCDAMER_TIMOUT | -1643 | The resource could not be acquired because a timeout occurred (the wait time specified in the lock service definition was exceeded). (This value is returned only when an unrecoverable DAM file is accessed.) |
DCDAMER_LCKOV | -1645 | The number of lock requests exceeds the specified maximum number of concurrent lock requests. |
DCDAMER_NO_ACL | -1646 | A DAM file to be opened is protected with the security facility. There is no ACL for the corresponding file. |
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.