DATA TYPES


RPG supports a wide variety of data types such as character, numeric, packed decimal, pointer, date, and time. Data types are used to declare field and array element attributes. This attribute is specified in the data-type position of the definition specification or it is inferred by the compiler when a variable is defined on the calculation specification. Table 1.6 lists the available data types supported by RPG.

Table 1.6: Data Types

Field Data Type

Data Type

Size/Extent

Description

Character

A or blank

1 to 65,535

Character.

Date

D

6, 8, or 10 bytes

Date. See also: Time, Timestamp.

Float

F

4 or 8 bytes

Double precision floating point.

Graphic (DBCS)

G

32,766

Double-byte character set — Graphic Data or UCS-2.

Integer[1]

I

1, 2, 4, or 8 bytes

Integer. See also: Unsigned Integer 3i0=1 byte, 5i0=2 bytes, 10i0=4 bytes, 20i0=8 bytes.

Left Signed [2]

L

1 to 31

Signed numeric with sign on left side.

Indicator

N

1

Named indicator variable.

Packed

P

1 to 31

Packed decimal.

Pointer

*

16 bytes

Pointer. See also: PROCPTR keyword in Chapter 2.

Right Signed

R

1 to 31

Signed numeric with sign on right side.

RPG Binary

B

2 or 4

RPG "Binary": four or nine digits of accuracy.

Signed

S or blank

1 to 31

Signed numeric with integrated sign.

Time

T

8

Time. See also: Date, Timestamp.

Timestamp

Z

26

Date/Timestamp. See also: Date, Time.

Unsigned Integer

U

1, 2, 4, or 8 bytes

Unsigned integer. See also: Integer.

[1]The INTEGER and UNSIGNED INTEGER data types can be used in place of the binary fields.

[2]Left- and right-signed numeric data-types are typically not used in RPG III and RPG IV.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net