Previous Topic Next topic Print topic


Setting the COBSQL Preprocessor and Compiler Directive Options

You can specify the COBSQL preprocessor and its directives using any of the following methods:
Note: Adding the Oracle Pro*COBOL (COBSQL) preprocessor to the SQL file or project property page automatically adds a read-only entry to the top of the preprocessors list in the SQL property page. If you have multiple preprocessors in the preprocessors list, you can change the sequence of execution by moving preprocessors up and down the list. See section Additional Preprocessors for more information.
In your Visual COBOL Project Properties
Before compiling from within Visual COBOL:

For Oracle Pro*COBOL, you can set the COBSQL preprocessor and compiler directives from the SQL tab in your project properties:

  1. From the Solution Explorer, open your project properties, then click the SQL tab.
  2. From the ESQL Preprocessor list, select Oracle Pro*COBOL (COBSQL).
  3. Click Add, select a directive from the Available Directives list, then click OK. This places the directive in the Directives list.
  4. Optionally, you can change the details for a directive by selecting it from the Directives list and then modifying the fields and controls under Directive Details.
  5. Repeat the previous two steps to add additional directives.
    Note: When using this method, you can also specify Pro*COBOL directives to pass to the database precompiler by typing them directly into the Additional Directives field.
  6. Click Apply and then OK.
In your Visual COBOL File Properties
As a default, files in your project inherit the settings specified at project level. To specify the COBSQL preprocessor for an individual file in your project that differs from the SQL preprocessor settings at project level:

For Oracle Pro*COBOL you can set the COBSQL preprocessor and compiler directives from the SQL tab in your file properties:

  1. From the Solution Explorer, open your file properties, then click the SQL tab.
  2. From the ESQL Preprocessor list, select Oracle Pro*COBOL (COBSQL).
  3. Click Add, select a directive from the Available Directives list, then click OK. This places the directive in the Directives list.
  4. Optionally, you can change the details for a directive by selecting it from the Directives list and then modifying the fields and controls under Directive Details.
  5. Repeat the previous two steps to add additional directives.
    Note: When using this method, you can also specify Pro*COBOL directives to pass to the database precompiler by typing them directly into the Additional Directives field.
  6. Click Apply and then OK.
On the Command Line
Use this method when compiling from a Visual COBOL command prompt. See PREPROCESS(cobsql) and COBSQL Compiler Directives for details.
In a Directives File
You can include COBSQL directives in the cobsql.dir file, the cobol.dir system-wide directives file, or a user directives file. For COBSQL applications, we recommend that you place your directives in only one of these files:
cobsql.dir file
To ensure that COBSQL retrieves its compiler directives from a cobsql.dir file, you must specify the COBSQL preprocessor (without additional directives) either in your project properties or on the command line. This instructs COBSQL to look for cobsql.dir as its first task. The cobsql.dir file must reside in either the current directory or in a directory specified by the COBDIR environment variable. COBSQL searches the current directory and then along the COBDIR path for cobsql.dir. COBSQL uses the first found instance of cobsql.dir. Using any text editor, follow these rules when creating the content of a cobsql.dir file:
  • Do not include COBOL compiler directives in cobsql.dir. COBOL does not read the cobsql.dir file.
  • Put one or more COBSQL directives on each line in the file.
  • Do not split a COBSQL directive across multiple lines.
  • When COBSQL encounters either END-C, END, or END-COBSQL, the rest of the line passes to the database precompiler.
  • The options to be passed to the database precompiler must all appear on a single line in the cobsql.dir file.
cobol.dir file and User Directives file
  • When the compiler encounters the PREPROCESS directive, it passes the rest of the line to COBSQL until it reaches ENDP.
  • The compiler treats the PREPROCESS directive and all the options that follow, up to the endp, as a single compiler directive. Therefore, the PREPROCESS directive and all its options must all appear on a single line.
See System-wide Directives File, cobol.dir, PREPROCESS(cobsql), COBSQL Compiler Directives, and User Directives File for details.
Embedded in a Program
You can also specify the COBSQL preprocessor and its directives on the program level by embedding a $SET statement into the program itself:
  • If you are using fixed source format (SOURCEFORMAT"FIXED", which is the default setting), place the $SET statement in column 7 on the first line of the program.
  • Follow the $SET statement with the appropriate PREPROCESS(cobsql) command-line syntax.
Important: Use this method only when the program requires a preprocessor different from other programs in an application.

See PREPROCESS(cobsql) and COBSQL Compiler Directives for details.

Previous Topic Next topic Print topic