COBOL data types supported by the data server

When you map user tables in the metadata catalogs on the data server, Classic Data Architect can convert COBOL data types to native types that the server supports and their corresponding SQL types.

Data types in a CREATE TABLE statement

When you map a new table, you can import data definitions in COBOL copybooks that describe the layout of the source database and the types associated with the data items. The information in the following table shows how Classic Data Architect converts COBOL data types to native and SQL types.

When you create a new user table in the metadata catalogs on a data server, you run a CREATE TABLE statement. Typically, this statement is found within Data Definition Language (DDL) that Classic Data Architect creates automatically when you run the Generate DDL wizard. The CREATE TABLE statement assigns a native data type to each column by using a DATATYPE keyword and assigns an SQL data type in a USE AS clause.

You can also use the information shown here to override the data types that are assigned to columns in a user table. One approach is to edit the DDL in an SQL Editor window. With VSAM or CICS VSAM sources, you can also change the native data type in the Classic Column Info properties window. Data types that you assign manually must be appropriate for the data in the source database.

Supported COBOL data types

The following table describes COBOL data types that the data server supports. The table also provides information about native and SQL types that correspond with each COBOL type.

COBOL element type

COBOL usage

Sign

Native data type

Length

SQL data type

Example

COBOLAlphabeticType
COBOLAlphaNumeric
Type

C

<= 32704

CHAR scale = 0

PIC X(4)

COBOLNumericType

Packed

decimal

T

P

DECIMAL

PIC S9(3) COMP-3

COBOLNumericType

Packed decimal

F

UP

DECIMAL

PIC 9(3) COMP-3

COBOLNumericType

Display

T

C

DECIMAL

PIC S99

COBOLNumericType

Display

F

UC

CHAR scale = 0

DECIMAL scale > 0

PIC 99

COBOLNumericType

Binary

T

H

SMALLINT

PIC S99 COMP-4

COBOLNumericType

Binary

F

UH

SMALLINT

PIC 99 COMP-4

COBOLNumericType

Binary

T

F

INTEGER

PIC S9(8) COMP-4

COBOLNumericType

Binary

F

UF

INTEGER

PIC 9(8) COMP-4

COBOLNumericType

Binary

D

DECIMAL

PIC 9(18) COMP-4

COBOLInternalFloatType

Float

F

REAL

COMP-1

COBOLInternalFloatType

Double

D

DOUBLE

COMP-2

COBOLDBCSType

DBCS

C

<= 16352

GRAPHIC

PIC G (or PIC N if NSymbol parser setting to DBCS)

COBOLAlphaNumeric
EditedType
COBOLNumericEdited
Type
COBOLExternalFloat
Type

C

<= 32704

CHAR

PIC clause is a display format that might contain B,P,Z,.,+,-,CR,DB,E

Native data types

The following table describes Classic data types and their equivalent SQL types. A CREATE TABLE statement specifies the native data type by using the DATATYPE parameter.

The Other SQL data types column lists alternative SQL types that you can specify as overrides by editing DDL in the SQL Editor window.

Table 1. Native data types
DATATYPE value Contents Standard SQL data type Other SQL data types
C Mixed mode character data. When the SQL data type is DECIMAL, the data is assumed to consist wholly of numbers with the right most number identifying the sign. CHAR

DECIMAL

DECIMAL, VARCHAR, GRAPHIC, or VARGRAPHIC, BINARY, VARBINARY
P Packed decimal data where the sign is stored in the far right aggregation of four bits. DECIMAL BINARY
D1 Floating point data. The columns length or precision determines whether the SQL data type is DOUBLE PRECISION or DECIMAL. 64-bit data is mapped as DECIMAL.

DOUBLE PRECISION

FLOAT(precision)

DECIMAL, BINARY

F2 32-bit signed binary value where the sign is in the high order bit. DECIMAL

INTEGER

REAL

FLOAT(precision)

BINARY

H 16-bit signed binary value where the sign is in the high order bit. DECIMAL

SMALLINT

BINARY
V Variable mixed-mode character data, where the actual data is preceded by a 16-bit signed binary number that identifies the actual length of the data. VARCHAR LONG VARCHAR, VARGRAPHIC, or LONG VARGRAPHIC, VARBINARY
UC Unsigned zoned-decimal data where the last character does not identify the sign. The value is always a positive value. DECIMAL CHAR, BINARY, VARBINARY
UP Packed decimal data where the sign bit is ignored. The value is always positive. DECIMAL BINARY
UF Unsigned 32-bit binary value. INTEGER BINARY
UH Unsigned 16-bit binary value. SMALLINT BINARY
B3 Fixed length binary data. BINARY DECIMAL, INTEGER, SMALLINT, VARBINARY
VB3 Variable length binary data, where the actual data is preceded by a 16-bit signed binary number that identifies the actual length of the data. VARBINARY N/A

1The SQL data type is DOUBLE PRECISION or FLOAT. DOUBLE PRECISION is shorthand for an 8-byte floating point number. In the USE AS clause, you can identify this data type as DOUBLE PRECISION or FLOAT(precision). If the precision value is in the range 22–53, the column represents an 8-byte floating point number. If you assign FLOAT, specify the maximum precision. The column length is based on the precision.

2The SQL data type is REAL or FLOAT. REAL is shorthand for a 4-byte floating point number. In the USE AS clause, you can identify this data type as REAL or FLOAT(precision). If the precision value is in the range 1–21, the column represents a 4-byte floating point number. If you assign FLOAT, specify the maximum precision. The column length is based on the precision.

3 Although Cobol does not support native binary types, you can manually edit the DDL to use binary data types.