MySQL Data Type Compatibility

The following table describes data type compatibility for MySQL and AcuSQL.

SQL Type COBOL Type Description
CHAR (n) 01 name PIC X(n) . Fixed-length character string n <= 255
VARCHAR(n) 01 name.

49 name-length PIC S9(4) COMP-5.

49 name-name PIC X(n).

Variable-length character string (n <= 255). Sub-items should be level 49.
TINYINT PIC 9(04) / PIC 9(02). * 1 byte -128 to +127
SMALLINT PIC 9(09) / PIC 9(04). * 2 bytes -32768 to +32767
MEDIUMINT PIC 9(09) / PIC 9(06). * 3 bytes -8388608 to +8388607
INTEGER (INT) PIC 9(10) / PIC 9(09). * 4 bytes -2147483648 to+2147483647
FLOAT 01 name USAGE IS FLOAT. 4-byte field
DOUBLE 01 name USAGE IS DOUBLE. 8-byte field
DECIMAL(p,n) 01 name PIC S9(m)V9(n). Numeric where m = p - n and p denotes the precision (in digits).
DATE 01 name PIC X(10) Format is YYYY-MM-DD
TIME 01 name PIC X(8) or X(14) Format HH:MM:SS or

HHHH:MM:SS

range -839:59:59 to 838:59:59

DATETIME 01 name PIC X(19) Format is YYYY-MM-DD HH:MM:SS

(space between day and hour)

Range 1000-01-01 00:00:00 to 9999-12-31 23:59:59

TIMESTAMP 01 name PIC X(19) 26-byte character string

* For numeric fields, unless the COBOL program is compiled with the -Dz option, the number will be truncated based on the number of 9’s in the picture clause. For maximum compatibility, use the larger picture size.

Note: Database and table names in MySQL are case-sensitive. Column names are not. There are multiple possible engines with MySQL.