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 FML

VIEW Conversion to and from Target Format

A VIEW can be converted to and from a target record format. The default target format is that of IBM System/370 COBOL records.

Fvstot, Fvftos and Fcodeset

The following functions convert targets:

long
Fvstot(char *cstruct, char *trecord, long treclen, char *viewname)

long
Fvttos(char *cstruct, char *trecord, char *viewname)

int 
Fcodeset(char *translation_table)

The Fvstot function transfers data from a C structure to a target record type. The Fvttos function transfers data from a target record to a C structure. trecord is a pointer to the target record. cstruct is a pointer to a C structure. viewname is a pointer to the name of a compiled view description. The VIEWDIR and VIEWFILES environment variables are used to find the directory and file containing the compiled view description.

To convert an FML buffer to a target record, complete the following procedure.

  1. Call Fvftos to convert the FML buffer to a C structure.

  2. Call Fvstot to convert to a target record.

To convert a target record to an FML buffer, complete the following procedure.

  1. Call Fvttos to convert to a C structure.

  2. Call Fvstof to convert the structure to an FML buffer.

The default target is that of IBM/370 COBOL records. The default data conversion is done as shown in the following table.

Data Conversion from a Structure to a Record

Struct

Record

float

COMP-1

double

COMP-2

long

S9(9) COMP

short

S9(4) COMP

int

S9(9) COMP or S9(4) COMP

dec_t(m, n)

S9(2*m-(n+1))V9(n)COMP-3

ASCII char

EBCDIC char

ASCII string

EBCDIC string

carray

character array

No filler bytes are provided between fields in an IBM/370 record. The COBOL SYNC clause should not be specified for any data items that are a part of the structure corresponding to the view. An integer field is converted to either a four-byte or two-byte integer, depending on the size of integers on the machine on which the conversion is done. A string field in the view must be terminated with a null when converting to and from the IBM/370 format. The data in a carray field is passed unchanged; no data translation is performed.

Packed decimals exist in the IBM/370 environment as two decimal digits packed into one byte with the low-order half byte used to store the sign. The length of a packed decimal may be 1 to 16 bytes with storage available for 1 to 31 digits and a sign. Packed decimals are supported in C structures using the dec_t field type. The dec_t field has a defined size consisting of two numbers separated by a comma. The number to the left of the comma is the total number of bytes occupied by the decimal. The number to the right is the number of digits to the right of the decimal point. The following formula is used for conversion.

dec_t(m, n) <=> S9(2*m-(n+1))V9(n)COMP-3

Decimal values may be converted to and from other data types (such as int, long, string, double, and float) using the functions described in decimal(3c).

See the Fvstof, Fvstof32(3fml) for a description of the default character conversion of ASCII to EBCDIC, and vice-versa.

An alternate character translation table can be used at run time by calling Fcodeset. The translation_table must point to 512 bytes of binary data. The first 256 bytes of data are interpreted as the ASCII-to-EBCDIC translation table. The second 256 bytes of data are interpreted as the EBCDIC-to-ASCII table. Any data after the 512th byte is ignored. If the pointer is NULL, the default translation is used.

For more information, refer to Fvstot, Fvttos(3fml) and in the BEA Tuxedo FML Function Reference.