Admin Production rocket
Current Publication

Preprocessor Directives and Options

NetExpress Bookshelf Help V5.1 WrapPack 1
Rocket® Net Express™ (formerly a product of Micro Focus or formerly a product of Open Text) documentation, created before Rocket Software acquired certain products from OpenText, may include outdated references to "Micro Focus" or "OpenText", both of which are trademarks of OpenText or its affiliates. Rocket Software is not affiliated with Micro Focus or OpenText and has since rebranded these products as Rocket® products. You may also encounter outdated links in this documentation. If you do, please contact Rocket Support (support@rocketsoftware.com) for assistance.

Chapter 7: Preprocessor Directives and Options

The SQL Option Preprocessor uses a type of preprocessor interface called an External Compiler Module (ECM) interface which is tightly integrated with the Compiler and debugger. The ECM only gets passed statements that begin with EXEC SQL.

SQL Option Preprocessor Options

This SQL Option Preprocessor uses the XDB compiler directive, which is used with several options. Certain of these options, such as DB2, are automatically set to a default value. Most XDB directive options have an alternate (or negative) syntax whereby the condition established by the option can be turned off. The default syntax for each option is underlined. XDB directive options are not case sensitive. For a complete list of options for the XDB compiler directive, see the topic XDB Directive Options.

For a list of SQL Option preprocessor error messages, see the topic SQL Preprocessor Errors

Setting Additional Options Under the IDE

When you create a new project or add a new program to an existing project, a scan is done to determine if EXEC SQL statements are in the program. If they are, the XDB directive is automatically set for that program. You can set additional SQL Option preprocessor options by selecting Build Settings for that program and selecting the Preproc tab and clicking on the EXEC SQL More... button. Once all the preprocessor options have been set, just select "Compile" to compile a program.

Debug Files

If an error occurs when compiling a program that requires technical support, your support representative might ask you to provide additional debug files to help in determining the cause of the problem. You obtain these debug files by specifying extra DB2 Compiler directives. You might want to specify some of these directives to help in your own debugging efforts. The directives are:

Directive File created Function
CHKECM(CTRACE) ecmtrace.txt This file contains pseudo COBOL code that shows the code generated to replace the EXEC SQL statements. This code is equivalent to output from the IBM DB2 COBOL precompiler.
CHKECM(TRACE) ecmtrace.txt This file contains detailed information as to what information is passed between the DB2 ECM and the Compiler. If an error occurs that generates invalid syntax, this file will be needed to help isolate where the problem occurred.
XDB(CTRACE) sqltrace.txt This file contains a detailed list of information passed to IBM Precompiler Services, and the results. This file is very useful if an error might involve a bug in the DB2 system software as well as the DB2 ECM.
ECMLIST program-name.lst This file is the standard COBOL list file, with pseudo COBOL code that shows the code generated to replace the EXEC SQL statements. You must also compile the program with the CHKECM(CTRACE) and LIST directives.

In the example listed above, to compile the same program and generate two of the debug files, the command line entry would be:

Cobol test1 xdb(validate fillsyscat ctrace) chkecm(trace) gnt;

Support for Object Oriented COBOL Syntax

The SQL Option preprocessor has been enhanced to work with Object Oriented COBOL syntax (OO programs). There is, however, one restriction that you should be aware of:

  • If you use an EXEC SQL WHENEVER statement within a METHOD, any additional METHODs coded in the same CLASS that have SQL statements in them need to have the section that is referenced in the preceding WHENEVER statement defined. Not doing this results in a compilation error indicating that the section has not been defined. You can get around this restriction by defining another EXEC SQL WHENEVER statement.

Copyright © 2007 Micro Focus (IP) Ltd. All rights reserved.