Examples



The following examples illustrate typical scenarios of manipulating HDF files and demonstrate how much cleaner it is to solve these in HDFql (across different languages). Additionally, a quick start guide covering the most commonly used HDFql operations can be found here, and the complete reference manual is available here.


  EXAMPLE 1
  • Find all datasets existing in an HDF file named "data.h5" that start with "temperature" and are of type float
  • For each dataset found, print its name and read its data
  • Write the data into a file named "output.txt" in an ascending order
  • Each value (belonging to the data) is written in a new line using a UNIX-based end of line (EOL) terminator

C API

#include "hdf5.h"

herr_t object_info(hid_t object_id, const char *object_name, void *operator_data);

int main(int argc, char *argv[])
{
   
hid_t file_id;
   
FILE *handle;
   
file_id = H5Fopen("data.h5", H5F_ACC_RDWR, H5P_DEFAULT);
   
handle = fopen("output.txt", "wb");
   
H5Giterate(file_id, "/", NULL, object_info, handle);
   
fclose(handle);
   
H5Fclose(file_id);
   
return 0;
}

herr_t object_info(hid_t object_id, const char *object_name, void *operator_data)
{
   
H5G_stat_t status;
   
hid_t dataset_id;
   
hid_t datatype_id;
   
H5T_class_t class;
   
hid_t dataspace_id;
   
float *data;
   
float tmp;
   
int count;
   
int i;
   
int j;
   
H5Gget_objinfo(object_id, object_name, 0, &status);
   
if (status.type == H5G_GROUP)
   
{
      
H5Giterate(object_id, object_name, NULL, object_info, operator_data);
   
}
   
else if (status.type == H5G_DATASET)
   
{
      
if (strncmp(object_name, "temperature", 11) == 0)
      
{
         
dataset_id = H5Dopen(object_id, object_name, H5P_DEFAULT);
         
datatype_id = H5Dget_type(dataset_id);
         
class = H5Tget_class(datatype_id);
         
if (class == H5T_FLOAT)
         
{
            
printf("Dataset found: %s\n", object_name);
            
dataspace_id = H5Dget_space(dataset_id);
            
count = H5Sget_simple_extent_npoints(dataspace_id);
            
H5Sclose(dataspace_id);
            
data = (float *) malloc(count * sizeof(float));
            
H5Dread(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
            
for(i = 0; i < count - 1; i++)
            
{
               
for(j = i + 1; j < count; j++)
               
{
                  
if (*(data + i) > *(data + j))
                  
{
                     
tmp = *(data + i);
                     
*(data + i) = *(data + j);
                     
*(data + j) = tmp;
                  
}
               
}
            
}
            
for(i = 0; i < count; i++)
            
{
               
fprintf((FILE *) operator_data, "%f\n", *(data + i));
            
}
         
}
         
H5Tclose(datatype_id);
         
H5Dclose(dataset_id);
         
free(data);
         
data = NULL;
      
}
   
}
   
return 0;
}

C + HDFql

#include "HDFql.h"

int main(int argc, char *argv[])
{
   
char script[1024];
   
hdfql_execute("USE FILE data.h5");
   
hdfql_execute("SHOW DATASET LIKE **/^temperature WHERE DATATYPE IS FLOAT");
   
while(hdfql_cursor_next(NULL) == HDFQL_SUCCESS)
   
{
      
printf("Dataset found: %s\n", hdfql_cursor_get_char(NULL));
      
sprintf(script, "SELECT FROM %s ORDER ASC INTO UNIX FILE output.txt SPLIT 1", hdfql_cursor_get_char(NULL));
      
hdfql_execute(script);
   
}
   
hdfql_execute("CLOSE FILE");
   
return 0;
}

C++ + HDFql

#include "HDFql.hpp"

int main(int argc, char *argv[])
{
   
char script[1024];
   
HDFql::execute("USE FILE data.h5");
   
HDFql::execute("SHOW DATASET LIKE **/^temperature WHERE DATATYPE IS FLOAT");
   
while(HDFql::cursorNext() == HDFql::Success)
   
{
      
printf("Dataset found: %s\n", HDFql::cursorGetChar());
      
sprintf(script, "SELECT FROM %s ORDER ASC INTO UNIX FILE output.txt SPLIT 1", HDFql::cursorGetChar());
      
HDFql::execute(script);
   
}
   
HDFql::execute("CLOSE FILE");
   
return 0;
}

Java + HDFql

public class Example
{
   
public static void main(String args[])
   
{
      
System.loadLibrary("HDFql");
      
HDFql.execute("USE FILE data.h5");
      
HDFql.execute("SHOW DATASET LIKE **/^temperature WHERE DATATYPE IS FLOAT");
      
while(HDFql.cursorNext() == HDFql.SUCCESS)
      
{
         
System.out.println("Dataset found: " + HDFql.cursorGetChar());
         
HDFql.execute("SELECT FROM " + HDFql.cursorGetChar() + " ORDER ASC INTO UNIX FILE output.txt SPLIT 1");
      
}
      
HDFql.execute("CLOSE FILE");
   
}
}

Python + HDFql

import HDFql

HDFql.execute("USE FILE data.h5")
HDFql.execute("SHOW DATASET LIKE **/^temperature WHERE DATATYPE IS FLOAT")
while HDFql.cursor_next() == HDFql.SUCCESS:
   
print("Dataset found: %s" % HDFql.cursor_get_char())
   
HDFql.execute("SELECT FROM %s ORDER ASC INTO UNIX FILE output.txt SPLIT 1" % HDFql.cursor_get_char())
HDFql.execute("CLOSE FILE")







C# + HDFql

public class Example
{
   
public static void Main(string[] args)
   
{
      
HDFql.Execute("USE FILE data.h5");
      
HDFql.Execute("SHOW DATASET LIKE **/^temperature WHERE DATATYPE IS FLOAT");
      
while(HDFql.CursorNext() == HDFql.Success)
      
{
         
System.Console.WriteLine("Dataset found: {0}", HDFql.CursorGetChar());
         
HDFql.Execute("SELECT FROM " + HDFql.CursorGetChar() + " ORDER ASC INTO UNIX FILE output.txt SPLIT 1");
      
}
      
HDFql.Execute("CLOSE FILE");
   
}
}

Fortran + HDFql

PROGRAM Example
   
USE HDFql
   
INTEGER :: state
   
state = hdfql_execute("USE FILE data.h5" // CHAR(0))
   
state = hdfql_execute("SHOW DATASET LIKE **/^temperature WHERE DATATYPE IS FLOAT" // CHAR(0))
   
DO WHILE(hdfql_cursor_next() .EQ. HDFQL_SUCCESS)
      
WRITE(*, *) "Dataset found: ", hdfql_cursor_get_char()
      
state = hdfql_execute("SELECT FROM " // hdfql_cursor_get_char() // " ORDER ASC INTO UNIX FILE output.txt SPLIT 1" // CHAR(0))
   
END DO
   
state = hdfql_execute("CLOSE FILE" // CHAR(0))
END PROGRAM


  EXAMPLE 2
  • Create an HDF file named "painters.h5"
  • Inside the file, create a group named "picasso" that tracks the creation order of objects stored within it
  • Inside the group, create a dataset named "guernica" of type integer of two dimensions with size 200x150
  • The dataset is organized through chunks of 40x30 and uses Fletcher32 checksum for error detection
  • Write an incremented value (starting from 0) in each position of the dataset
  • Inside the dataset, create an attribute named "subject" of type UTF8 variable char with the value "guerra civil española"

C API

#include "hdf5.h"

int main(int argc, char *argv[])
{
   
hid_t file_id;
   
hid_t group_id;
   
hid_t dataset_id;
   
hid_t attribute_id;
   
hid_t dataspace_id;
   
hid_t group_property_list;
   
hid_t dataset_property_list;
   
hsize_t dimension_list[2];
   
hsize_t dimension;
   
hid_t type;
   
int values[200][150];
   
char *subject[1];
   
int x;
   
int y;
   
file_id = H5Fcreate("painters.h5", H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
   
group_property_list = H5Pcreate(H5P_GROUP_CREATE);
   
H5Pset_link_creation_order(group_property_list, H5P_CRT_ORDER_TRACKED);
   
group_id = H5Gcreate(file_id, "picasso", H5P_DEFAULT, group_property_list, H5P_DEFAULT);
   
dimension_list[0] = 200;
   
dimension_list[1] = 150;
   
dataspace_id = H5Screate_simple(2, dimension_list, NULL);
   
dataset_property_list = H5Pcreate(H5P_DATASET_CREATE);
   
H5Pset_fletcher32(dataset_property_list);
   
dimension_list[0] = 40;
   
dimension_list[1] = 30;
   
H5Pset_chunk(dataset_property_list, 2, dimension_list);
   
for(x = 0; x < 200; x++)
   
{
      
for(y = 0; y < 150; y++)
      
{
         
values[x][y] = x * 150 + y;
      
}
   
}
   
dataset_id = H5Dcreate(group_id, "guernica", H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, dataset_property_list, H5P_DEFAULT);
   
H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, values);
   
type = H5Tcopy(H5T_C_S1);
   
H5Tset_cset(type, H5T_CSET_UTF8);
   
H5Tset_size(type, H5T_VARIABLE);
   
dimension = 1;
   
dataspace_id = H5Screate_simple(1, &dimension, NULL);
   
attribute_id = H5Acreate(dataset_id, "subject", type, dataspace_id, H5P_DEFAULT, H5P_DEFAULT);
   
subject[0] = "guerra civil española";
   
H5Awrite(attribute_id, type, subject);
   
H5Tclose(type);
   
H5Aclose(attribute_id);
   
H5Sclose(dataspace_id);
   
H5Pclose(dataset_property_list);
   
H5Dclose(dataset_id);
   
H5Pclose(group_property_list);
   
H5Gclose(group_id);
   
H5Fclose(file_id);
   
return 0;
}

C + HDFql

#include "HDFql.h"

int main(int argc, char *argv[])
{
   
int values[200][150];
   
char script[1024];
   
int x;
   
int y;
   
hdfql_execute("CREATE FILE painters.h5");
   
hdfql_execute("USE FILE painters.h5");
   
hdfql_execute("CREATE GROUP picasso ORDER TRACKED");
   
hdfql_execute("CREATE CHUNKED(40, 30) DATASET picasso/guernica AS INT(200, 150) ENABLE FLETCHER32");
   
for(x = 0; x < 200; x++)
   
{
      
for(y = 0; y < 150; y++)
      
{
         
values[x][y] = x * 150 + y;
      
}
   
}
   
hdfql_variable_register(&values);
   
sprintf(script, "INSERT INTO picasso/guernica VALUES FROM MEMORY %u", hdfql_variable_get_number(&values));
   
hdfql_execute(script);
   
hdfql_variable_unregister(&values);
   
hdfql_execute("CREATE ATTRIBUTE picasso/guernica/subject AS UTF8 VARCHAR DEFAULT \"guerra civil española\"");
   
hdfql_execute("CLOSE FILE");
   
return 0;
}

C++ + HDFql

#include "HDFql.hpp"

int main(int argc, char *argv[])
{
   
int values[200][150];
   
char script[1024];
   
int x;
   
int y;
   
HDFql::execute("CREATE FILE painters.h5");
   
HDFql::execute("USE FILE painters.h5");
   
HDFql::execute("CREATE GROUP picasso ORDER TRACKED");
   
HDFql::execute("CREATE CHUNKED(40, 30) DATASET picasso/guernica AS INT(200, 150) ENABLE FLETCHER32");
   
for(x = 0; x < 200; x++)
   
{
      
for(y = 0; y < 150; y++)
      
{
         
values[x][y] = x * 150 + y;
      
}
   
}
   
HDFql::variableRegister(&values);
   
sprintf(script, "INSERT INTO picasso/guernica VALUES FROM MEMORY %u", HDFql::variableGetNumber(&values));
   
HDFql::execute(script);
   
HDFql::variableUnregister(&values);
   
HDFql::execute("CREATE ATTRIBUTE picasso/guernica/subject AS UTF8 VARCHAR DEFAULT \"guerra civil española\"");
   
HDFql::execute("CLOSE FILE");
   
return 0;
}

Java + HDFql

public class Example
{
   
public static void main(String args[])
   
{
      
Integer values[][] = new Integer[200][150];
      
int x;
      
int y;
      
System.loadLibrary("HDFql");
      
HDFql.execute("CREATE FILE painters.h5");
      
HDFql.execute("USE FILE painters.h5");
      
HDFql.execute("CREATE GROUP picasso ORDER TRACKED");
      
HDFql.execute("CREATE CHUNKED(40, 30) DATASET picasso/guernica AS INT(200, 150) ENABLE FLETCHER32");
      
for(x = 0; x < 200; x++)
      
{
         
for(y = 0; y < 150; y++)
         
{
            
values[x][y] = x * 150 + y;
         
}
      
}
      
HDFql.variableRegister(values);
      
HDFql.execute("INSERT INTO picasso/guernica VALUES FROM MEMORY " + HDFql.variableGetNumber(values));
      
HDFql.variableUnregister(values);
      
HDFql.execute("CREATE ATTRIBUTE picasso/guernica/subject AS UTF8 VARCHAR DEFAULT \"guerra civil española\"");
      
HDFql.execute("CLOSE FILE");
   
}
}

Python + HDFql

import HDFql
import numpy

HDFql.execute("CREATE FILE painters.h5")
HDFql.execute("USE FILE painters.h5")
HDFql.execute("CREATE GROUP picasso ORDER TRACKED")
HDFql.execute("CREATE CHUNKED(40, 30) DATASET picasso/guernica AS INT(200, 150) ENABLE FLETCHER32")
values = numpy.ndarray([200, 150], numpy.int32)
for x in range(200):
   
for y in range(150):
      
values[x][y] = x * 150 + y
HDFql.variable_register(values)
HDFql.execute("INSERT INTO picasso/guernica VALUES FROM MEMORY %d" % HDFql.variable_get_number(values))
HDFql.variable_unregister(values)
HDFql.execute("CREATE ATTRIBUTE picasso/guernica/subject AS UTF8 VARCHAR DEFAULT \"guerra civil española\"")
HDFql.execute("CLOSE FILE")

C# + HDFql

public class Example
{
   
public static void Main(string[] args)
   
{
      
int[,] values = new int[200, 150];
      
int x;
      
int y;
      
HDFql.Execute("CREATE FILE painters.h5");
      
HDFql.Execute("USE FILE painters.h5");
      
HDFql.Execute("CREATE GROUP picasso ORDER TRACKED");
      
HDFql.Execute("CREATE CHUNKED(40, 30) DATASET picasso/guernica AS INT(200, 150) ENABLE FLETCHER32");
      
for(x = 0; x < 200; x++)
      
{
         
for(y = 0; y < 150; y++)
         
{
            
values[x, y] = x * 150 + y;
         
}
      
}
      
HDFql.VariableRegister(values);
      
HDFql.Execute("INSERT INTO picasso/guernica VALUES FROM MEMORY " + HDFql.VariableGetNumber(values));
      
HDFql.VariableUnregister(values);
      
HDFql.Execute("CREATE ATTRIBUTE picasso/guernica/subject AS UTF8 VARCHAR DEFAULT \"guerra civil española\"");
      
HDFql.Execute("CLOSE FILE");
   
}
}

Fortran + HDFql

PROGRAM Example
   
USE HDFql
   
CHARACTER :: string_number
   
INTEGER, DIMENSION(200, 150) :: values
   
INTEGER :: state
   
INTEGER :: x
   
INTEGER :: y
   
state = hdfql_execute("CREATE FILE painters.h5" // CHAR(0))
   
state = hdfql_execute("USE FILE painters.h5" // CHAR(0))
   
state = hdfql_execute("CREATE GROUP picasso ORDER TRACKED" // CHAR(0))
   
state = hdfql_execute("CREATE CHUNKED(40, 30) DATASET picasso/guernica AS INT(200, 150) ENABLE FLETCHER32" // CHAR(0))
   
DO x = 1, 150
      
DO y = 1, 200
         
values(y, x) = x * 200 + y - 201
      
END DO
   
END DO
   
state = hdfql_variable_register(LOC(values))
   
WRITE(string_number, "(I0)") state
   
state = hdfql_execute("INSERT INTO picasso/guernica VALUES FROM MEMORY " // string_number // CHAR(0))
   
state =
hdfql_variable_unregister(LOC(values))
   
state = hdfql_execute("CREATE ATTRIBUTE picasso/guernica/subject AS UTF8 VARCHAR DEFAULT ""guerra civil española""" // CHAR(0))
   
state = hdfql_execute("CLOSE FILE" // CHAR(0))
END PROGRAM


  EXAMPLE 3
  • Create an HDF file named "my_file.h5"
  • Inside the file, create a dataset named "my_dataset" of type short of two dimensions with size UNLIMITEDx1024
  • The dataset is extendible on its first dimension (to store an unknown volume of data) and compressed with ZLIB
  • Acquire data from a process which returns an array of 1024 shorts on each reading
  • Write the acquired data into the dataset using hyperslab functionalities (so that already stored data is not overwritten)

C API

#include "hdf5.h"

int main(int argc, char *argv[])
{
   
hid_t file_id;
   
hid_t dataset_id;
   
hid_t dataspace_id;
   
hid_t memoryspace_id;
   
hid_t property_list;
   
hsize_t dimension_list[2];
   
hsize_t max_dimension_list[2];
   
hsize_t offset_list[2];
   
hsize_t stride_list[2];
   
hsize_t count_list[2];
   
hsize_t block_list[2];
   
hsize_t dimension;
   
short values[1024];
   
file_id = H5Fcreate("my_file.h5", H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
   
dimension_list[0] = 1;
   
dimension_list[1] = 1024;
   
max_dimension_list[0] = H5S_UNLIMITED;
   
max_dimension_list[1] = 1024;
   
dataspace_id = H5Screate_simple(2, dimension_list, max_dimension_list);
   
property_list = H5Pcreate(H5P_DATASET_CREATE);
   
H5Pset_chunk(property_list, 2, dimension_list);
   
H5Pset_deflate(property_list, 9);
   
dataset_id = H5Dcreate(file_id, "my_dataset", H5T_NATIVE_SHORT, dataspace_id, H5P_DEFAULT, property_list, H5P_DEFAULT);
   
H5Sclose(dataspace_id);
   
dimension = 1024;
   
memoryspace_id = H5Screate_simple(1, &dimension, NULL);
   
offset_list[0] = 0;
   
stride_list[0] = 1;
   
count_list[0] = 1;
   
block_list[0] = 1;
   
offset_list[1] = 0;
   
stride_list[1] = 1;
   
count_list[1] = 1;
   
block_list[1] = 1024;
   
while(acquire(values)) // call hypothetical function that acquires data
   
{
      
dataspace_id = H5Dget_space(dataset_id);
      
H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset_list, stride_list, count_list, block_list);
      
H5Dwrite(dataset_id, H5T_NATIVE_SHORT, memoryspace_id, dataspace_id, H5P_DEFAULT, values);
      
H5Sclose(dataspace_id);
      
offset_list[0]++;
      
dimension_list[0]++;
      
H5Dset_extent(dataset_id, dimension_list);
   
}
   
H5Sclose(memoryspace_id);
   
H5Pclose(property_list);
   
H5Dclose(dataset_id);
   
H5Fclose(file_id);
   
return 0;
}

C + HDFql

#include "HDFql.h"

int main(int argc, char *argv[])
{
   
char script[100];
   
short values[1024];
   
int row;
   
hdfql_execute("CREATE FILE my_file.h5");
   
hdfql_execute("USE FILE my_file.h5");
   
hdfql_execute("CREATE CHUNKED DATASET my_dataset AS SMALLINT(UNLIMITED, 1024) ENABLE ZLIB");
   
hdfql_variable_register(&values);
   
row = 0;
   
while(acquire(values)) // call hypothetical function that acquires data
   
{
      
sprintf(script, "INSERT INTO my_dataset(%d) VALUES FROM MEMORY %u", row++, hdfql_variable_get_number(&values));
      
hdfql_execute(script);
      
hdfql_execute("ALTER DIMENSION my_dataset TO (+1)");
   
}
   
hdfql_variable_unregister(&values);
   
hdfql_execute("CLOSE FILE");
   
return 0;
}

C++ + HDFql

#include "HDFql.hpp"

int main(int argc, char *argv[])
{
   
char script[100];
   
short values[1024];
   
int row;
   
HDFql::execute("CREATE FILE my_file.h5");
   
HDFql::execute("USE FILE my_file.h5");
   
HDFql::execute("CREATE CHUNKED DATASET my_dataset AS SMALLINT(UNLIMITED, 1024) ENABLE ZLIB");
   
HDFql::variableRegister(&values);
   
row = 0;
   
while(acquire(values)) // call hypothetical function that acquires data
   
{
      
sprintf(script, "INSERT INTO my_dataset(%d) VALUES FROM MEMORY %u", row++, HDFql::variableGetNumber(&values));
      
HDFql::execute(script);
      
HDFql::execute("ALTER DIMENSION my_dataset TO (+1)");
   
}
   
HDFql::variableUnregister(&values);
   
HDFql::execute("CLOSE FILE");
   
return 0;
}

Java + HDFql

public class Example
{
   
public static void main(String args[])
   
{
      
Short values[] = new Short[1024];
      
int row;
      
System.loadLibrary("HDFql");
      
HDFql.execute("CREATE FILE my_file.h5");
      
HDFql.execute("USE FILE my_file.h5");
      
HDFql.execute("CREATE CHUNKED DATASET my_dataset AS SMALLINT(UNLIMITED, 1024) ENABLE ZLIB");
      
HDFql.variableRegister(values);
      
row = 0;
      
while(acquire(values)) // call hypothetical function that acquires data
      
{
         
HDFql.execute("INSERT INTO my_dataset(" + (row++) + ") VALUES FROM MEMORY " + HDFql.variableGetNumber(values));
         
HDFql.execute("ALTER DIMENSION my_dataset TO (+1)");
      
}
      
HDFql.variableUnregister(values);
      
HDFql.execute("CLOSE FILE");
   
}
}

Python + HDFql

import HDFql
import numpy

HDFql.execute("CREATE FILE my_file.h5")
HDFql.execute("USE FILE my_file.h5")
HDFql.execute("CREATE CHUNKED DATASET my_dataset AS SMALLINT(UNLIMITED, 1024) ENABLE ZLIB")
values = numpy.ndarray([1024], numpy.int16)
HDFql.variable_register(values)
row = 0
while acquire(values): # call hypothetical function that acquires data
   
HDFql.execute("INSERT INTO my_dataset(%d) VALUES FROM MEMORY %d" % (row, HDFql.variable_get_number(values)))
   
HDFql.execute("ALTER DIMENSION my_dataset TO (+1)")
   
row = row + 1
HDFql.variable_unregister(values)
HDFql.execute("CLOSE FILE")

C# + HDFql

public class Example
{
   
public static void Main(string[] args)
   
{
      
short[] values = new short[1024];
      
int row;
      
HDFql.Execute("CREATE FILE my_file.h5");
      
HDFql.Execute("USE FILE my_file.h5");
      
HDFql.Execute("CREATE CHUNKED DATASET my_dataset AS SMALLINT(UNLIMITED, 1024) ENABLE ZLIB");
      
HDFql.VariableRegister(values);
      
row = 0;
      
while(Acquire(values)) // call hypothetical function that acquires data
      
{
         
HDFql.Execute("INSERT INTO my_dataset(" + (row++) + ") VALUES FROM MEMORY " + HDFql.VariableGetNumber(values));
         
HDFql.Execute("ALTER DIMENSION my_dataset TO (+1)");
      
}
      
HDFql.VariableUnregister(values);
      
HDFql.Execute("CLOSE FILE");
   
}
}

Fortran + HDFql

PROGRAM Example
   
USE HDFql
   
CHARACTER(5) :: string_row
   
CHARACTER :: string_number
   
INTEGER(2), DIMENSION(1024) :: values
   
INTEGER :: state
   
INTEGER :: row
   
state = hdfql_execute("CREATE FILE my_file.h5" // CHAR(0))
   
state = hdfql_execute("USE FILE my_file.h5" // CHAR(0))
   
state = hdfql_execute("CREATE CHUNKED DATASET my_dataset AS SMALLINT(UNLIMITED, 1024) ENABLE ZLIB" // CHAR(0))
   
state = hdfql_variable_register(LOC(values))
   
WRITE(string_number, "(I0)") state
   
row = 0
   
DO WHILE(acquire(values)) ! call hypothetical function that acquires data
      
WRITE(string_row, "(I0)") row
      
state = hdfql_execute("INSERT INTO my_dataset(" // string_row // ") VALUES FROM MEMORY " // string_number // CHAR(0))
      
state = hdfql_execute("ALTER DIMENSION my_dataset TO (+1)" // CHAR(0))
      
row = row + 1
   
END DO
   
state = hdfql_variable_unregister(LOC(values))
   
state = hdfql_execute("CLOSE FILE" // CHAR(0))
END PROGRAM