OpenTP1 Version 7 Programming Reference COBOL Language

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

CBLDCDAM('WRIT') - Output a logical file block

Format

PROCEDURE DIVISION specification

CALL  'CBLDCDAM'  USING  unique-name-1  unique-name-2
                         unique-name-n

DATA DIVISION specification

01  unique-name-1.
    02  data-name-A    PIC X(8) VALUE 'DCDAMSVC'.
    02  data-name-B    PIC X(5).
    02  FILLER        PIC X(3).
    02  data-name-C    PIC X(8).
    02  data-name-D    PIC S9(9) COMP.
    02  data-name-E    PIC S9(9) COMP.
    02  data-name-H    PIC S9(9) COMP.
    02  FILLER        PIC X(28).
01  unique-name-2.
    02  data-name-F    PIC X(4) VALUE 'WRIT'.
    02  data-name-G    PIC X(1).
    02  FILLER        PIC X(1).
    02  FILLER        PIC X(1).
    02  FILLER        PIC X(1).
    02  data-name-Z    PIC S9(9) COMP VALUE ZERO.
    02  unique-name-3.
        03  data-name-I    PIC S9(9) COMP.
        03  data-name-J    PIC S9(9) COMP.
    02  unique-name-4.
        03  data-name-I    PIC S9(9) COMP.
        03  data-name-J    PIC S9(9) COMP.
          :
          :
    02  unique-name-m.
        03  data-name-I    PIC S9(9) COMP.
        03  data-name-J    PIC S9(9) COMP.
01  unique-name-n.
    02  data-name-K    PIC X(n).

Description

CBLDCDAM('WRIT') outputs a specified block. The timing of outputting blocks is shown 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.

Lock which is enabled for a block input for reference processing is released in the following case:

After the block is input for reference processing, an input request for update processing is made for the same block. Then, an input error occurs during the update processing.

When outputting a logical file block, specify the logical file name and the file descriptor returned from CBLDCDAM('OPEN').

Data areas whose values are set in the UAP

data-name-A

Specify VALUE 'DCDAMSVC' for the interface code used with the DAM file.

data-name-C

Specify a logical file name with up to 8 characters. If the specified logical file name comprises less than 8 characters, pad the remaining portion with space.

data-name-D

Specify the number of blocks from unique-name-3 to unique-name-m (number of sets of data-name-I and data-name-J).

data-name-E

Specify the length of output data. The output data length must be (block length to be output x number of blocks to be output).

'Number of blocks to be output' is the sum of blocks specified with the number of blocks from unique-name-3 to unique-name-m (number of sets of data-name-I and data-name-J).

data-name-H

Specify the file descriptor returned when the logical file was opened.

data-name-F

Specify VALUE 'WRIT' for the request code indicating the output of a logical file block.

data-name-G

Specify whether the program is to wait for the resource to be released from lock if a lock error occurs.

VALUE 'W': The program waits for the resource to be released from lock.

VALUE 'N': The program does not wait for the resource to be released from lock, and returns with an error.

VALUE SPACE : Processing is done according to the value specified for data-name-G of CBLDCDAM('OPEN').

If VALUE SPACE is specified or no value is specified, the subsequent processing is as follows:

However, if files-based lock is specified as the lock type in CBLDCDAM('OPEN') with the file descriptor specified for data-name-H, the value specified for data-name-G is meaningless.

data-name-Z

Specify 0.

data-name-I

Specify the first relative block number of the block to be accessed.

data-name-J

Specify the last relative block number of the block to be accessed. If 0 is specified, only the relative block number specified for data-name-I is output.

data-name-K

Specify an output data area (buffer).

Data area to which a value is returned from OpenTP1

data-name-B

A status code of 5 digits is returned.

Status codes

Status code Explanation
00000 All blocks were output normally.
01600 CBLDCRPC('OPEN ') was not called.
CBLDCDAM('WRIT') was called outside the transaction range. (This error is returned only when accessing a recoverable DAM file.)
'N' is specified for atomic_update in the user service definition. (This error is returned only when accessing a recoverable DAM file.)
CBLDCDAM('STRT') was not called. (This error is returned only when accessing an unrecoverable DAM file.)
The UAP is incorrectly linked as follows:
  • The library (-1tdam) to be used for access to a TAM file using the DAM service API is linked incorrectly.
  • The definition of the resource manager for transaction control object files is incorrect.
01602 A lock error occurred.
01603 The file descriptor specified for data-name-H is not the one which was acquired by opening the file normally.
The DAM file is not open.
01604 The output data length (block length to be output x number of blocks to be output) is too short.
01605 The sequence for accessing the DAM file is invalid.
01606 The relative block number is invalid.
01607 The memory became insufficient.
01609 The value specified for data-name-D is smaller than 1.
01611 The value specified for data-name-G is invalid.
01613 The number of block updates exceeded the maximum number of blocks that can be updated during one transaction according to the DAM service definition. (This error is returned only when accessing a recoverable DAM file.)
01620 An output error occurred. (This error is returned only when accessing an unrecoverable DAM file.)
01621 The specified file is in logical shutdown state.
01622 The specified file is in shutdown state due to an error.
01628 The DAM file to be accessed is protected by the security facility. The UAP attempting to input a logical file block has no access permission.
01629 A transaction service error occurred. (This error is returned only when accessing a recoverable DAM file.)
01641 The output data length (block length to be output x number of blocks to be output) is too long.
01642 A deadlock occurred.
01643 The resource could not be acquired because a timeout occurred (the wait time specified in the lock service definition was exceeded).
01645 The number of lock requests exceeds the specified maximum number of concurrent lock requests.
01648 The number of blocks exceeded the maximum number of accessible blocks. (This error is returned only when accessing an unrecoverable DAM file.)
01690 The interface code (data-name-A) is invalid.
01691 The request code (data-name-F) is invalid.

Note

If the status code 01613 or 01648 is returned, take the following actions: