BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy


   Tuxedo Doc Home   |   Programming   |   Topic List   |   Previous   |   Next   |   Contents

   Programming a BEA Tuxedo Application Using C

Using a VIEW Typed Buffer

There are two kinds of VIEW typed buffers. The first, FML VIEW, is a C structure generated from an FML buffer. The second is simply an independent C structure.

The reason for converting FML buffers into C structures and back again (and the purpose of the FML VIEW typed buffers) is that while FML buffers provide data-independence and convenience, they incur processing overhead because they must be manipulated using FML function calls. C structures, while not providing flexibility, offer the performance required for lengthy manipulations of buffer data. If you need to perform a significant amount of data manipulation, you can improve performance by transferring fielded buffer data to C structures, operating on the data using normal C functions, and then converting the data back to the FML buffer for storage or message transmission.

For more information on the FML typed buffer and FML file conversion, refer to the BEA Tuxedo FML Function Reference.

To use VIEW typed buffers, you must perform the following steps:

Setting Environment Variables for a VIEW Typed Buffer

To use a VIEW typed buffer in an application, you must set the following environment variables.

Environment Variables for a VIEW Typed Buffer

Environment Variable



Comma-separated list of field table file names for FML or FML32 typed buffers. Required only for FML VIEW types.


Colon-separated list of directories to search for the field table files for FML and FML32 typed buffers. For Microsoft Windows, use a semi-colon separated list. Required only for FML VIEW types.


Comma-separated list of allowable file names for VIEW or VIEW32 description files.


Colon-separated list of directories to search for VIEW or VIEW32 files. For Microsoft Windows, use a semi-colon separated list.

Creating a View Description File

To use a VIEW typed buffer, you must define the C record in a view description file. The view description file includes, a view for each entry, a view that describes the characteristic C structure mapping and the potential FML conversion pattern. The name of the view corresponds to the name of the C language structure.

The following format is used for each structure in the view description file.

$ /* View structure */
VIEW viewname
type cname fbname count flag size null

The following table describes the fields that must be specified in the view description file for each C structure.

View Description File Fields




Data type of the field. Can be set to short, long, float, double, char, string, or carray.


Name of the field as it appears in the C structure.


If you will be using the FML-to-VIEW or VIEW-to-FML conversion functions, this field must be included to indicate the corresponding FML name. This field name must also appear in the FML field table file. This field is not required for FML-independent VIEWs.


Number of times field occurs.


Specifies any of the following optional flag settings:


For STRING and CARRAY buffer types, specifies the maximum length of the value. This field is ignored for all other buffer types.


User-specified NULL value, or - to indicate the default value for a field. NULL values are used in VIEW typed buffers to indicate empty C structure members.

The default NULL value for all numeric types is 0 (0.0 for dec_t). For character types, the default NULL value is `\0'. For STRING and CARRAY types, the default NULL value is " ".

Constants used, by convention, as escape characters can also be used to specify a NULL value. The view compiler recognizes the following escape constants: \ddd (where d is an octal digit), \0, \n, \t, \v, \r, \f, \\, \', and \".

You may enclose STRING, CARRAY, and char NULL values in double or single quotes. The view compiler does not accept unescaped quotes within a user-specified NULL value.

You can also specify the keyword NONE in the NULL field of a view member description, which means that there is no NULL value for the member. The maximum size of default values for string and character array members is 2660 characters. For more information, refer to the BEA Tuxedo FML Function Reference.

You can include a comment line by prefixing it with the # or $ character. Lines prefixed by a $ sign are included in the .h file.

The following listing is an excerpt from an example view description file based on an FML buffer. In this case, the fbname field must be specified and match that which appears in the corresponding field table file. Note that the CARRAY1 field includes an occurrence count of 2 and sets the C flag to indicate that an additional count element should be created. In addition, the L flag is set to establish a length element that indicates the number of characters with which the application populates the CARRAY1 field.

View Description File for FML VIEW

$ /* View structure */
#type cname fbname count flag size null
float float1 FLOAT1 1 - - 0.0
double double1 DOUBLE1 1 - - 0.0
long long1 LONG1 1 - - 0
short short1 SHORT1 1 - - 0
int int1 INT1 1 - - 0
dec_t dec1 DEC1 1 - 9,16 0
char char1 CHAR1 1 - - '\0'
string string1 STRING1 1 - 20 '\0'
carray carray1 CARRAY1 2 CL 20 '\0'

The following listing illustrates the same view description file for an independent VIEW.

View Description File for an Independent View

$ /* View data structure */
#type cname fbname count flag size null
float float1 - 1 - - -
double double1 - 1 - - -
long long1 - 1 - - -
short short1 - 1 - - -
int int1 - 1 - - -
dec_t dec1 - 1 - 9,16 -
char char1 - 1 - - -
string string1 - 1 - 20 -
carray carray1 - 2 CL 20 -

Note that the format is similar to the FML-dependent view, except that the fbname and null fields are not relevant and are ignored by the viewc compiler. You must include a value (for example, a dash) as a placeholder in these fields.

Executing the VIEW Compiler

To compile a VIEW typed buffer, run the viewc command, specifying the name of the view description file as an argument. To specify an independent VIEW, use the -n option. You can optionally specify a directory in which the resulting output file should be written. By default, the output file is written to the current directory.

For example, for an FML-dependent VIEW, the compiler is invoked as follows.

viewc myview.v

Note: To compile a VIEW32 typed buffer, run the viewc32 command.

For an independent VIEW, use the -n option on the command line, as follows.

viewc -n myview.v

The output of the viewc command includes:

The following listing provides an example of the header file created by viewc.

Header File Created Using the VIEW Compiler

struct MYVIEW {
float float1;
double double1;
long long1;
short short1;
int int1;
dec_t dec1;
char char1;
char string1[20];
unsigned short L_carray1[2]; /* length array of carray1 */
short C_carray1; /* count of carray1 */
char carray1[2][20];

The same header file is created for FML-dependent and independent VIEWs.

In order to use a VIEW typed buffer in client programs or service subroutines, you must specify the header file in the application #include statements.

See Also