Error Messages When Compiling Program

There are two significant differences when using DB2 LUW versus mainframe DB2. The first is that you have to connect to the database before you can compile a program. With mainframe DB2 you can pre-compile a program without DB2 being active. The second major difference is that all columns and tables referenced in the program must be created in the database before a program can be compiled whereas with mainframe DB2 they don't have to be. In both cases, the mainframe DB2 pre-compiler uses the DECLARE TABLE information in an SQL INCLUDE copybook to determine valid syntax as opposed to DB2 LUW which uses DB2 system catalog information to validate statements. In either case, a SQL Error could result using DB2 DB2 LUW is basically compatible with DB2 for z/OS, with some exceptions in DML syntax and functions supported and certain DDL statements that are hardware/operating system specific. Host Compatibility Option tries to address some of the main areas of incompatibility where possible by converting DB2 for z/OS SQL statements to supported DB2 LUW syntax. .

In addition, if invalid SQL syntax is encountered while compiling your program, a SQL error is also generated for each statement in error. The text that is associated with the SQL error is displayed using the following format:

DB0100e SQLnnnnnn error-text

Where DB indicates error resulted from DB2 ECM (the error number is always 0100); e is the error severity, and SQLnnnnnn is the SQL error code (nnnnnn may vary between 2 and 6 characters).