The needed modules have to be declared by a use
statement like:
In the initial phase of the program the UIO routine package has to
initialized by exactly one call of the uio_init
routine with the name
of the program as optional parameter:
The internal list of logical I/O unit numbers may be changed with
calls of uio_chunit
and uio_chconv
.
A file can be opened for writing with
Header and data block are written together with one command as e.g. in:
There are two different routines to close a file after reading or writing. A file opened for writing is closed by:
To open a file for reading, only the file name has to specified. File form and conversion type are determined automatically:
In contrast to the writing of an entry by one routine call the reading is performed in two separate sub-steps for the header and the data part. After the reading of the header e.g. with
the identifier, type, and dimension (if any)
of the entry is contained in the character array termt
with ntt
entries
and special actions may be taken: The data part may be skipped with
or it can be read with:
If the entry is an array it may be necessary to allocate memory:
Alternatively, it is possible to search in the file for a special entry or to search in a specially generated entry list with:
Additionally, the module uio_var_module
makes it possible to read any
entry into an UIO flexible variable,
and the module uio_varfile_module
allows the reading of a complete file
into a special file structure of UIO flexible variables.
To close a file after reading use
There are several examples of programs with UIO routines like
uio_var_test.f90
,
uio_varfile_test.f90
,
uiotst.f90
,
(uio_demo.f90
) and - of course - CO5BOLD.