OpenTP1 Version 7 Programming Guide

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

4.1.5 Access to a DAM file in offline mode (operation from a UAP that handles offline work)

The contents of a DAM file can be output under the batch environment. Close a physical file opened in offline mode as soon as processing terminates. After a physical file is opened, a mixture of input and output operations is not permitted. Before starting block input or output, close the physical file once. Functions for use offline cannot be used online (SUP, SPP, MHP). If you use these functions online, operation is not guaranteed.

Organization of this subsection
(1) Name used when a DAM file is accessed
(2) Inputting/outputting blocks
(3) Inputting/outputting multiple blocks collectively
(4) Initializing/recreating blocks

(1) Name used when a DAM file is accessed

To open a physical file, use the function dc_dam_iopen() [CBLDCDMB ('OPEN')] in which the physical file name set upon the file allocation is specified. When the physical file is opened, the file descriptor is returned. Shut down the file descriptor in the UAP because the file descriptor is used for processing between when the file is opened and when the file is closed.

For processing after the file is opened, specify this file descriptor in the function to access the file. The processing includes block input (dc_dam_get()) and block output (dc_dam_put()). To close the physical file, use the function dc_dam_iclose() [CBLDCDMB('CLOSE')] in which the file descriptor is specified.

(2) Inputting/outputting blocks

When a physical file is opened using the function dc_dam_iopen(), its blocks can be input/output in one of the following two methods:

Only the former method allows specifying that multiple blocks should be input/output collectively.

(3) Inputting/outputting multiple blocks collectively

When a physical file is allocated and opened, the number of blocks can be specified as an input/output unit.

(4) Initializing/recreating blocks

When an input block is output to a physical file, it is possible to specify whether the area following the block to be output is to be padded with null characters. Specify INITIALIZE to pad the area following the block to be output with null characters. Otherwise, specify OVERWRITE. When OVERWRITE is specified, an arbitrary block can be input/output. In this case, the area following the output block is not updated and remains as it is.

Whether to fill the remaining blocks with null characters is specified in the argument to the function dc_dam_iopen(). This specification will be in effect when a block is output to the file using the function dc_dam_put() and the file is closed using the function dc_dam_iclose(). If the UAP is terminated without using the function dc_dam_iclose(), the remaining blocks are not filled with null characters. To fill the remaining blocks with null characters, be sure to call the function dc_dam_iclose().

The figure below shows the procedure for accessing DAM files in offline mode.

Figure 4-3 Procedure for accessing DAM files in offline mode

[Figure]