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 Preprocessor file
, build configuration or project property page automatically adds a read-only entry to the top of the preprocessors list in the
Additional Preprocessors 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:
Note: You can also set the preprocessor under
Micro Focus > Build Configurations > COBOL > SQL Preprocessor. If you do this, the setting applies only when the build configuration is active, and the preprocessor is not set to something else in the project settings or at the program level.
For Oracle Pro*COBOL, you can set the COBSQL preprocessor and compiler directives from the project's properties:
- Expand
Micro Focus > Project Settings > COBOL > SQL Preprocessor.
- Check
Use SQL Preprocessor.
- From the
Preprocessor Type list, select
Oracle Pro*COBOL(COBSQL).
- Under
Setting choose a directive and specify its value under
Value.
- Repeat the previous step to add additional directives.
- Click
Apply, then click
OK.
Note: Ensure that no conflicting preprocessor directives are set in
Additional Directives.
- 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 only, you can set the COBSQL preprocessor and compiler directives from the file properties:
- Open your file properties and expand
COBOL > SQL Preprocessor.
- Check
Enable file specific settings.
- Check
Use SQL Preprocessor.
- Under
Setting choose a directive and specify its value under
Value.
- Repeat the previous step to add additional directives.
- Click
Apply, then click
OK.
Note: Ensure that no conflicting preprocessor directives are set in
Additional Directives.
- On the Command Line
- Use this method when compiling from aVisual 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.