Reading data, Datasetget function – HP XP P9500 Storage User Manual
Page 125

When the datasetOpen function terminates successfully, it returns a handle that identifies the dataset
opened. The datasetHandle information is used as the argument of subsequent functions such as
datasetGet
, datasetPut, or datasetClose. Do not change the datasetHandle value returned
by this function. If the datasetOpen function terminates unsuccessfully, it returns a value of -1. To
get the error code information, execute the datasetGetLastError function (see “
The datasetOpen function has the following restrictions:
•
Only one dataset at a time can be open within one process. When multiple datasets need to be
opened, the open dataset must be closed before another dataset can be opened. This restriction
does not apply to open-system files.
•
A dataset that is being accessed by the datasetFindFirstFile or datasetFindNextFile
function cannot be opened. The datasetFindClose function must be executed before the
dataset can be opened. This restriction does not apply to open-system files.
Reading Data
reclen = datasetGet (datasetHandle, buf, buflen)
The datasetGet function reads one record from the specified dataset (datasetHandle) and puts
the record into a buffer (buf) of length buflen. The datasetGet function extracts only the data
entity from each record and does not transfer the BL and RL bytes for variable-length records to the
buffer.
on page 125 shows the datasetGet arguments and return values.
Table 42 DatasetGet Function
Description
Type
Value
Item
The datasetHandle value returned by the
datasetOpen
function.
DATASET_HANDLE
datasetHandle
Argument
Buffer area for storing the read data.
char *
buf
Size of the buffer area. If the record is larger
than buflen or equal to zero, datasetGet
returns an error and does not transfer any
data to the buf.
long
buflen
Data entity size transferred to the buffer
long
reclen
Return value
Abnormal end
-1
on page 126 shows the format requirements for variable-length records accessed by the
datasetGet
function. Each variable-length block must start with the 2-byte BL field, and each
variable-length record must start with the 2-byte RL field. The datasetGet function automatically
extracts the data entities without the BL and RL fields.
HP StorageWorks P9000 Data Exchange User Guide
125