sqlDataCode

The sqlDataCode property provides mapping between EGL types and SQL types for code migrated from VisualAge® Generator.

EGL assumes a default mapping between EGL types and SQL types. EGL uses the mapping at declaration time, validation time, and run time. For a table showing that mapping, see Retrieving SQL table data in the EGL Programmer's Guide.

To override this default mapping in DB2®, you can use the SQL field level sqlDataCode property. This property used to be necessary in code migrated from VisualAge Generator, which lacked equivalents for many current EGL data types. The property is maintained primarily for compatibility with earlier versions.

For example, assume you have a HEX field in your EGL SQL record whose equivalent field in the database table is an SQL INTEGER. To get the data to map properly, set the sqlDataCode property for the EGL field to a number that identifies the appropriate SQL data type. The code for an SQL INTEGER is 497:
Record ExampleSQLRecord type SQLRecord
  myHexVar HEX(8) {sqlDataCode = 497};  // matches SQL INTEGER
end

The following table shows sqlDataCode values in DB2 for the various SQL data types.

Table 1. sqlDataCode values from DB2
SQL data type sqlDataCode
BIGINT 493
BIT n/a in DB2
BLOB 405
BOOLEAN n/a in DB2
CHAR 453
CLOB 409
DATE 385
DECIMAL 485
DOUBLE 481
FLOAT 481
GRAPHIC 469
INTEGER 497
LONG VARBINARY 481
LONG VARCHAR 457
LONG VARGRAPHIC 473
NUMERIC 485
REAL 481
SMALLINT 501
TIME 389
TIMESTAMP 393
VARBINARY 481
VARCHAR 449
VARGRAPHIC 465

Feedback