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 COBOL

Defining Equivalent Data Types

The following table lists the C data types for which equivalent COBOL data types are available.

COBOL Equivalents for C Data Types

C Data Type

Equivalent COBOL Data Type

float

COMP-1

double

COMP-2

long

S9(9) COMP-51

short

S9(4) COMP-51

dec_t

COBOL COMP-3 packed decimal field

1

COMP-5, provided for use with MicroFocus COBOL, allows the COBOL integer fields to match the data format of the corresponding C fields. The data type for VS COBOL II is COMP.

For storage efficiency, COBOL supports packed decimals: two decimal digits packed into each byte with the low-order half byte used to store the sign. The length of a packed decimal may be 1 to 9 bytes with storage available for 1 to 17 digits, including the sign.

The dec_t field is defined in a VIEW. The size is specified as two values separated by a comma. The first value indicates the total number of bytes occupied by the decimal in COBOL. The second value indicates the number of digits to the right of the decimal point in COBOL. You can use the following formula to convert the dec_t field to a COBOL declaration.

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

For example, a size specification of 6,4 in the VIEW indicates that there are 4 digits to the right of the decimal point and 7 digits to the left, and the last half byte is used to store the sign. A COBOL application programmer represents this as 9(7)V9(4), where the V represents the decimal point between each value. Note that FML does not support the dec_t type; if FML-dependent VIEWs are used, then each field must be mapped to a C type in the VIEW file. For instance, a packed decimal can be mapped to an FML string field, and then the mapping functions can be used to do the conversion between formats.