beautypg.com

Writing data -6, N writing data), Writing data – HP XP20000XP24000 Disk Array User Manual

Page 160

background image

6-6

Performing File Access Library (FAL) Operations

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

Writing Data

reclen = datasetPut (datasetHandle, buf, buflen)

The datasetPut function writes one record from the buf into the dataset

specified by datasetHandle. Table 6-3 shows the datasetPut arguments and
return values.

Table 6-3

DatasetPut Function

Item Value

Type

Description

Argument

datasetHandl
e

buf
buflen

DATASET_HAND

LE

char *
long

The datasetHandle value returned by the datasetOpen
function.

Buffer area for storing the write data.
Size of the buffer area. If any of the following conditions is detected,

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

-1

long

Data entity size written into the dataset.

Error end

Figure 6-2 shows 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)

2 bytes

2 bytes

Block length format:

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).