DB2 Server for VSE & VM: Application Programming


Defining DB2 Server for VSE & VM Data Types for PL/I


Figure 130. Data Types for PL/I
Description DB2 Server for VSE & VM   Keyword Equivalent PL/I   Declaration
A binary integer of 31 bits, plus sign. INTEGER or INT BINARY FIXED(31)
A binary integer of 15 bits, plus sign. SMALLINT BINARY FIXED(15)
A packed decimal number, precision p, scale s (1 <= p <= 31 and 0 <= s <= p). In storage the number occupies a maximum of 16 bytes. Precision is the total number of digits. Scale is the number of those digits that are to the right of the decimal point. DECIMAL[(p[,s])]   or DEC[(p[,s])]1 1 FIXED DECIMAL(p,s)
A single-precision (4- byte) floating-point number, in short System/390 floating-point format. REAL or   FLOAT(p), 1 <= p <= 21 BINARY FLOAT(p) or   FLOAT BINARY(p), 1 <= p <= 21   DECIMAL FLOAT(p) or   FLOAT DECIMAL(p), 1 <= p <= 7
A double-precision (8- byte) floating-point number, in long System/390 floating-point format. FLOAT or   FLOAT(p), 22 <= p <= 53   or DOUBLE PRECISION BINARY FLOAT(p) or   FLOAT BINARY(p), 22 <= p <= 53   DECIMAL FLOAT(p) or   FLOAT DECIMAL(p), 8 <= p <= 16
A fixed-length character string of length n where 0 < n <= 254. CHARACTER[(n)]   or CHAR[(n)] CHARACTER(n)
A varying-length character string of maximum length n. If n > 254 or <= 32 767, this data type is considered a long field. See Using Long Strings for more information. VARCHAR(n) CHARACTER(n) VARYING
A varying-length character string of maximum length 32,767 bytes. LONG VARCHAR CHARACTER(n) VARYING
A fixed-length string of n DBCS characters where 0 < n <= 127. GRAPHIC[(n)] GRAPHIC(n)
A varying-length string of n DBCS characters. If n > 127 or <= 16 383, this data type is considered a long field. See Using Long Strings for more information. VARGRAPHIC(n) GRAPHIC(n) VARYING
A varying-length string of DBCS characters of maximum length 16 383. LONG VARGRAPHIC GRAPHIC(n) VARYING
A fixed or varying-length character string representing a date. The minimum and maximum lengths vary with both the format used and whether it is an input or output operation. See the DB2 Server for VSE & VM SQL Reference manual for more information. DATE
CHARACTER(n) or
CHARACTER(n) VARYING

A fixed or varying-length character string representing a time. The minimum and maximum lengths vary with both the format used and whether it is an input or output operation. See the DB2 Server for VSE & VM SQL Reference manual for more information. TIME
CHARACTER(n) or
CHARACTER(n) VARYING

A fixed or varying-length character string representing a timestamp. The lengths can vary on input and output. See the DB2 Server for VSE & VM SQL Reference manual for more information. TIMESTAMP
CHARACTER(n) or
CHARACTER(n) VARYING

Notes:

  1. NUMERIC is a synonym for DECIMAL and may be used when creating or altering tables. In such cases, however, the CREATE or ALTER function will establish the column (or columns) as DECIMAL.

  2. The data type can be stated in any way that is acceptable to PL/I; BIN FIXED(31), BINARY FIXED(31), and FIXED BIN(31) are all equivalent. If several variables have exactly the same attributes, you can combine them in a single DCL statement:
       DCL (X,Y,Z) BIN FIXED;
    


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