HP StorageWorks P9000 Data Exchange User Guide (T1620-96016, September 2010)

Figure 77 Format Requirements for Reading Variable-Length Records
.
When the datasetGet function terminates successfully, it returns the length of the data entity read
from the dataset. If the datasetGet function detects the end of dataset (EOF) or terminates
unsuccessfully, it returns a value of -1. To get the error code information, execute the
datasetGetLastError function (see Acquiring Error Information on page 127). For example,
when the datasetGet function detects the EOF, datasetGetLastError will return
DATASET_ERROR_END_OF_FILE.
Writing Data
reclen = datasetPut (datasetHandle, buf, buflen)
The datasetPut function writes one record from the buf into the dataset specified by
datasetHandle. Table 43 on page 126 shows the datasetPut arguments and return values.
Table 43 DatasetPut Function
DescriptionTypeValueItem
The datasetHandle value returned by the
datasetOpen function.
DATASET_HANDLEdatasetHandle
Argument
Buffer area for storing the write data.char *buf
Size of the buffer area. If any of the following
conditions are detected, datasetPut
returns an error and does not transfer any
data to the dataset:
For a fixed-length record: buflen RL
of the dataset
For a variable-length record: (buflen +
4) > RL of dataset
For a variable-length record: buflen =
0 (no data entity)
longbuflen
Data entity size written into the dataset.
long
reclen
Return value
Abnormal end-1
Figure 78 on page 127 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 2-byte RL field, and writes the record into the
Performing FAL Operations126