DATAFMT structure

Description

A DATAFMT structure is used to describe data values and program variables. For example:

Most functions use only a subset of the fields in a DATAFMT structure. For example, CTBBIND does not use the FMT-NAME, FMT-STATUS, and FMT-UTYPE fields, and CTBDESCRIBE does not use the FMT-FORMAT field. For information on which DATAFMT fields a function uses, see Table 2-3 in this chapter, or descriptions of the CTBBIND and CTBDESCRIBE functions located in the sections CTBBIND and CTBDESCRIBE in Chapter 3, “Functions.”

A DATAFMT structure is defined as follows:

	01 DATAFMT
	05 FMT-NAME PIC X(132).
	05 FMT-NAMELEN PIC S9(9) COMP SYNC.
	05 FMT-TYPE PIC S9(9) COMP SYNC.
	05 FMT-FORMAT PIC S9(9) COMP SYNC.
	05 FMT-MAXLEN PIC S9(9) COMP SYNC.
	05 FMT-SCALE PIC S9(9) COMP SYNC.
	05 FMT-PRECIS PIC S9(9) COMP SYNC.
	05 FMT-STATUS PIC S9(9) COMP SYNC.
	05 FMT-COUNT PIC S9(9) COMP SYNC.
	05 FMT-UTYPE PIC S9(9) COMP SYNC.
	05 FMT-LOCALE PIC S9(9) COMP SYNC.

Table 2-3 describes the fields in the DATAFMT structure.

Table 2-3: Fields in the DATAFMT structure

Field

Contents

Used by

FMT-NAME

The name of the data item.

CTBDESCRIBE CTBPARAM

FMT-NAMELEN

The length of FMT-NAME.

CTBDESCRIBE CTBPARAM

FMT-TYPE

The datatype of the data. See the specific call to find which data this refers to.

CSBCONVERT CTBBIND CTBDESCRIBE CTBPARAM

FMT-FORMAT

The format of the data, represented by symbolic values.

CTBBIND

FMT-MAXLEN

The maximum length of the data.

CSBCONVERT CTBBIND CTBDESCRIBE CTBPARAM

FMT-SCALE

The number of digits in the decimal part of a number. This field is used with packed decimal, numeric and Sybase-decimal.

CSBCONVERT CTBBIND

FMT-PRECIS

The total number of digits in a number. This field is used with packed decimal, numeric and Sybase-decimal.

CSBCONVERT CTBBIND

FMT-STATUS

Status values.

CTBDESCRIBE CTBPARAM

FMT-COUNT

The number of items.

CTBBIND CTBDESCRIBE

FM-UTYPE

The user-defined datatype (UDT) of retrieved data. The UDT is assigned by the server.

CTBDESCRIBE CTBPARAM

FMT-LOCALE

Reserved for future use.

CSBCONVERT CTBBIND CTBDESCRIBE CTBPARAM