Hitachi MK-96RD647-01 manual Writing Data, DatasetPut Function

Models: MK-96RD647-01

1 226
Download 226 pages 34.71 Kb
Page 160
Image 160

Writing Data

reclen = datasetPut (datasetHandle, buf, buflen)

The datasetPut function writes one record from the buf into the dataset specified by datasetHandle. Table 6-3shows the datasetPut arguments and return values.

Table 6-3

DatasetPut Function

 

 

 

 

 

 

Item

 

Value

Type

Description

 

 

 

 

 

Argument

 

datasetHandl

DATASET_HAND

The datasetHandle value returned by the datasetOpen

 

 

e

LE

function.

 

 

buf

 

Buffer area for storing the write data.

 

 

char *

Size of the buffer area. If any of the following conditions is detected,

 

 

buflen

 

 

long

datasetPut returns an error and does not transfer any data to the dataset:

 

 

 

For fixed-length record: buflen RL of the dataset

 

 

 

 

For variable-length record: (buflen + 4) > RL of dataset

 

 

 

 

For variable-length record: buflen = 0 (no data entity)

 

 

 

 

 

Return value

 

reclen

long

Data entity size written into the dataset.

 

 

-1

 

Error end

 

 

 

 

 

Figure 6-2shows the format requirements for variable-length records accessed by the datasetPut function. When the target dataset is variable-length, the datasetPut function takes the data entity from the buf, automatically adds the two-byte RL field, and writes the record into the dataset. When the data is written into the dataset, multiple records are blocked within the extent defined by the VTOC of the dataset.

Block length

Record length

Data entity

 

 

 

Record length

Data entity

 

 

Record length

Record length

Block Length (block length defined in VTOC)

 

Block length format:

2 bytes

2 bytes

 

 

Block length

0x0000

 

 

 

2 bytes

2 bytes

 

 

 

Record length format:

Record length

0x0000

 

 

 

Figure 6-2 Format Requirements for Writing Variable-Length Records

When the datasetPut function terminates successfully, it returns the length of the data entity written to the dataset. If the datasetPut function terminates unsuccessfully, it returns a value of -1. To get the error code information, execute the datasetGetLastError function (see section Acquiring Error Information).

6-6

Performing File Access Library (FAL) Operations

Hitachi USP V Cross-OS File Exchange User’s Guide

Page 160
Image 160
Hitachi MK-96RD647-01 manual Writing Data, DatasetPut Function, Reclen = datasetPut datasetHandle, buf, buflen