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 the description of the relevant function in the next chapter.

Definition

A DATAFMT structure is defined as follows:

DCL
01 DATAFMT,
05 FMT_NAME         CHAR(132),
05 FMT_NAMELEN  FIXED BIN(31),
05 FMT_TYPE          FIXED BIN(31),
05 FMT_FORMAT     FIXED BIN(31),
05 FMT_MAXLEN     FIXED BIN(31),
05 FMT_SCALE        FIXED BIN(31),
05 FMT_PRECIS      FIXED BIN(31),
05 FMT_STATUS      FIXED BIN(31),
05 FMT_COUNT       FIXED BIN(31),
05 FMT_UTYPE        FIXED BIN(31),
05 FMT_LOCALE       FIXED BIN(31);

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

FMT_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