HDFql Reference Manual v2.6.0

6.8.8SET USERBLOCK

Syntax

SET USERBLOCK [file_name [, file_name]*] VALUES {([userblock_value] [, [userblock_value]]*) | input_redirecting_option}

Description

Set (i.e. write) a user-defined block of data stored within an HDF5 file named file_name or within the HDF5 file currently in use in a space reserved for this purpose. Multiple files’ user-defined blocks of data can be written at once by separating their names with a comma (,).

Parameter(s)

file_name – optional string that specifies the name of the HDF5 file in which the user-defined block of data is set (i.e. written). If file_name is specified, the file is opened on the fly, the user-defined block of data is written into it, and the file is subsequently closed. If not specified, the file currently in use is used instead.

userblock_value – optional integer, float, or string to write as a user-defined block of data within the HDF5 file currently in use or within a certain HDF5 file.

input_redirecting_option – optional option that specifies the cursor in use, a (text, binary, or Excel) file, or memory (i.e. user-defined variable) to read data from in order to write it as a user-defined block within an HDF5 file or within the HDF5 file currently in use (please refer to the subsection FROM for additional information).

Return

Nothing

Example(s)

# create an HDF5 file named "my_file0.h5" with a user-defined block of data (size 512) storing values 0, 0, 0, 0, 0, 0, 0, ...
CREATE FILE my_file0.h5 USERBLOCK SIZE 512

# show (i.e. get) user-defined block of data stored within file "my_file0.h5" (should return 0, 0, 0, 0, 0, 0, 0, ...)
SHOW USERBLOCK my_file0.h5

# set (i.e. write) user-defined block of data stored within file "my_file0.h5" with values 50, 60, and 70
SET USERBLOCK my_file0.h5 VALUES(50, 60, 70)

# show (i.e. get) user-defined block of data stored within file "my_file0.h5" (should return 50, 60, 70, 0, 0, 0, 0, ...)
SHOW USERBLOCK my_file0.h5

# create an HDF5 file named "my_file1.h5" with a user-defined block of data (size 8192) storing values 0, 0, 0, 0, 0, 0, 0, ...
CREATE FILE my_file1.h5 USERBLOCK SIZE 8192

# use (i.e. open) HDF5 file "my_file1.h5" 
USE FILE my_file1.h5

# set (i.e. write) user-defined block of data stored within the file currently in use with values from a binary file named "my_file.pdf"
SET USERBLOCK VALUES FROM BINARY FILE my_file.pdf

# show (i.e. get) user-defined block of data stored within the file currently in use (should return the values (i.e. content) of file "my_file.pdf")
SHOW USERBLOCK