DIALECT statement prefixes enable you to specify DB2 to SQL Server conversion details for individual EXEC SQL statements, including SQL Server statements that conform to DB2 syntax. In this way, you can apply certain overrides and conversion routines to DB2-compatible SQL Server statements, such as qualification of unqualified tables and views, on an as-needed basis.
Over time, your migrated applications can evolve to use syntax that is specific to SQL Server rather than DB2. When compiling an application using the DIALECT=MAINFRAME compiler directive option, by default HCOSS assumes all statements are DB2 statements and converts them to SQL Server statements using the specifications provided by defined HCOSS data type mappings, SQL name mappings, and SQLCODE mappings. HCOSS also applies qualifiers for unqualified tables and views based on the use of the SQL(QUALIFIER) compiler directive option or the QUALIFIER parameter on a BIND PACKAGE or BIND PLAN command. Also by default, HCOSS applies no conversions to existing SQL Server statements, submitting them directly to the SQL Server database.
When compiling with DIALECT=MIXED, the conversions described above are only performed for statements that have a prefix of [MAINFRAME], and HCOSS assumes that by default all statements are SQL Server statements.
The choice between DIALECT=MAINFRAME and DIALECT=MIXED depends on whether the majority of statements should be processed as DB2 or SQL Server statements.
Statement prefixes must be used in conjunction with the DIALECT compiler directive option.
All of the following examples assume that DIALECT is set to either MAINFRAME or MIXED, and all SQLStatements are DB2 compatible.
The QUALIFIER compiler directive option is not set, and there is no specified QUALIFIER parameter.
EXEC SQL [NOPLAN] SQLStatement END-EXEC
The SQLStatement is converted but not qualified by HCOSS; it is not written to a DBRM, not written to a bind script file even when the BIND compiler directive option is set, and not used to create a stored procedure at compile time even when ACCESS compiler directive option is set.
The QUALIFIER compiler directive option is set.
EXEC SQL [MAINFRAME] SQLStatement END-EXEC
The SQLStatement is converted and qualified by HCOSS.
The QUALIFIER compiler directive option is set.
EXEC SQL [NOPLAN][MAINFRAME] SQLStatement END-EXEC
The SQLStatement is converted and qualified by HCOSS but is not written to a DBRM.
The QUALIFIER compiler directive option is set.
EXEC SQL [NODIALECT] SQLStatement END-EXEC
The SQLStatement is neither converted nor qualified by HCOSS.
The BIND or DBRMLIB compiler directive is set, along with the QUALIFIER compiler directive.
EXEC SQL [NOPLAN][NODIALECT] SQLStatement END-EXEC
The SQLStatement is neither converted nor qualified by HCOSS and is not written to a bind file or DBRM.