![]() |
![]() |
|
|
Field Name-to-Identifier Mappings
In the BEA Tuxedo system, fields are usually referred to by their field identifier (fldid), an integer. (Refer to Defining Field Names and Identifiers for a detailed description of field identifiers.) This allows you to reference fields in a program without using the field name, which may change.
Identifiers are assigned (mapped) to field names through one of the following:
A typical application might use one, or both of the above methods to map field identifiers to field names.
In order for FML to access the data in fielded records, there must be some way for FML to access the field name/identifier mappings. FML gets this information in one of two ways:
Field name/identifier mapping is not available in COBOL.
Run Time: Field Table Files
Field name/identifier mappings can be made available to FML programs at run time through field table files. It is the responsibility of the programmer to set two environment variables that tell FML where the field name/identifier mapping table files are located.
The environment variable FLDTBLDIR contains a list of directories where field tables can be found. The environment variable FIELDTBLS contains a list of the files in the table directories that are to be used. For FML32, the environment variable names are FLDTBLDIR32 and FIELDTBLS32.
Within application programs, the FML function Fldid() provides for a run-time translation of a field name to its field identifier. Fname() translates a field identifier to its field name (see Fldid(3fml) and Fname(3fml)). (The function names for FML32 are Fldid32 and Fname32.) The first invocation of either function causes space in memory to be dynamically allocated for the field tables and the tables to be loaded into the address space of the process. The space can be recovered when the tables are no longer needed. (Refer to Loading Field Tables for more information.)
This method should be used when field name/identifier mappings are likely to change throughout the life of the application. This topic is covered in more detail in Defining and Using Fields.
Compile Time: Header Files
Use mkfldhdr() (or mkfldhdr32()) to make header files out of field table files. These header files are included (with #include) in C programs, and provide another way to map field names to field identifiers: at compile time. For more information on mkfldhdr, mkfldhdr32(1), refer to BEA Tuxedo Command Reference.
Using field header files, the C preprocessor converts all field name references to field identifiers at compile time; thus, you do not need to use the Fldid() or Fname() functions as you would with the field table files described in the previous section.
If you always know the field names needed by your program, you can save some data space by including your field table header files (with #include). The space saving allows your program to get to the task at hand more quickly.
Because this method resolves mappings at compile time, however, it should not be used if the field name/identifier mappings in the application are likely to change. For more information, see Defining and Using Fields.
![]() |
![]() |
![]() |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|