EGL Reference Guide for iSeries

Numeric types

BIN and the integer types

An item of type BIN is interpreted as a binary value. The length can be 4, 9, or 18 and reflects the number of positive digits in decimal format, including any decimal places. The value -12.34, for example, fits in an item of length 4. A 4-digit number requires 2 bytes; a 9-digit number requires 4 bytes; and an 18-digit number requires 8 bytes.

For an item of length 4, the internal bit representations of example values are as follows:

  // for decimal 1234, the hexadecimal value is 04 D2:
  00000100 11010010
 
  // for decimal -1234, the value is the 2's complement (FB 2E):
  11111011 00101110

It is recommended that you use items of type BIN instead of other numeric types whenever possible; for example, for arithmetic operands or results, for array subscripts, and for key items in relative records.

The following types are equivalent to type BIN:


Related reference
Primitive types

DECIMAL

An item of type DECIMAL is a numeric value in which each half-byte is a hexadecimal character, and the sign is represented by a hexadecimal C (for a positive number) or a hexadecimal D (for a negative number) in the right half of the rightmost byte. The length reflects the number of digits and ranges from 1 to 32. To determine the number of bytes, add 2 to the length value, divide the sum by 2, and truncate any fraction in the result.

For an item of length 4, the internal hexadecimal representations of example values are as follows:

  // for decimal 123
  00 12 3C
 
  // for decimal -123
  00 12 3D
 
  // for decimal 1234
  01 23 4C
 
  // for decimal -1234
  01 23 4D

A negative value that is read from a file or database into a field of type DECIMAL may have a hexadecimal B in place of a D; EGL accepts the value but converts the B to D.

The format of a DB2 UDB column of type DECIMAL is equivalent to the format of a DECIMAL-type host variable.


Related reference
Primitive types

NUM

An item of type NUM is a numeric value in which each byte is a digit in character format, and the sign is represented by a sign-specific hexadecimal value in the left half of the rightmost byte. The length reflects both the number of digits and the number of bytes. The length ranges from 1 to 32.

For an item of length 4, the internal hexadecimal representations of example values are as follows if the item is on a host environment which uses EBCDIC:

  // for decimal 1234
  F1 F2 F3 F4
 
  // for decimal -1234
  F1 F2 F3 D4

The internal hexadecimal representations of example values are as follows if the item is on a workstation environment like Windows 2000, which uses ASCII:

  // for decimal 1234
  31 32 33 34
 
  // for decimal -1234
  31 32 33 74


Related reference
Primitive types

NUMC

An item of type NUMC is a numeric value in which each byte is a digit in character format, and the sign is represented by a sign-specific hexadecimal value in the left half of the rightmost byte. The length reflects both the number of digits and the number of bytes and ranges from 1 to 32.

For an item of length 4, the internal hexadecimal representations of example values are as follows if the item is on a host environment which uses EBCDIC:

  // for decimal 1234
  F1 F2 F3 C4
 
  // for decimal -1234
  F1 F2 F3 D4

The internal hexadecimal representations of example values are as follows if the item is on a workstation environment like Windows 2000, which uses ASCII:

  // for decimal 1234
  31 32 33 34
 
  // for decimal -1234
  31 32 33 74


Related reference
Primitive types

PACF

An item of type PACF is a numeric value in which each half-byte is a hexadecimal character, and the sign is represented by a hexadecimal F (for a positive number) or a hexadecimal D (for a negative number) in the right half of the rightmost byte. The length reflects the number of digits and ranges from 1 to 32. To determine the number of bytes, add 2 to the length value, divide the sum by 2, and truncate any fraction in the result.

For an item of length 4, the internal hexadecimal representations of example values are as follows:

  // for decimal 123
  00 12 3F
 
  // for decimal -123
  00 12 3D
 
  // for decimal 1234
  01 23 4F
 
  // for decimal -1234
  01 23 4D

A negative value that is read from a file or database into a field of type PACF may have a hexadecimal B in place of D; EGL accepts the value but converts the B to D.


Related reference
Primitive types


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]