Including Externally Described Multiple Record Formats in a
Logical File
To include multiple formats in a logical file, specify more than
one record format name or (*ALL) on the #pragma mapinc directive.
If you specify multiple formats, a header description and type definition
is created for each format. If you specify a union- type-name, a union
type definition is created.
C++ users must use the GENCSRC utility to create
type definitions from an external file.
C users can use either the GENCSRC utility or the #pragma
mapinc directive to create type definitions from an
external file.
The typedef union contains structure definitions created for each
format. Structure definitions that are created for key fields when
the key option is specified are not included in the union definition.
The name of the union definition is union-type-name_t. The name you
provide for the union-type-name is not folded to uppercase.
The following shows the type definitions created for a logical
file with two record formats with the BOTH and KEY options specified.
A typedef union with the tag buffer_t is also generated.
Note: A typedef union is not created for the key fields.
If you specify *ALL, or more than one record format on the format-name
parameter, structure definitions for multiple formats are created.
If you specify multiple formats, and the input, or output option,
one structure is created for each format. The following shows the
structure definitions that are created when you include the following
statements in your program. The device file TESTLIB⁄FILE contains
two record formats, FMT1, and FMT2. Each record format has fields
defined as OUTPUT in its file description.
When both are specified as an option, two structure definitions
are created for each format. The following shows the structure definitions
created when you include two formats, FMT1 and FMT2, for the device
file EXAMPLE⁄TEST and specify the both option:
If all the fields are defined as BOTH
and there are to be no indicators in the typedef struct, only one
typedef struct is generated for each format specified. The following
shows a separate typedef structure for input and output fields.