Preprocessing Tools

This chapter describes how to use OFCOBOL preprocessing tools and related options. You can check compilation options by using the -h option.

1. ofconv

Converts IDMS COBOL syntax to COBOL syntax that can be used in OpenFrame.

  • Usage

    Usage : ofconv -i <source-file> [options]
  • Options

    Option Description

    -saveretcode

    Restores the RETURN-CODE value in a program after an NDB2 statement is called.

    -dmlseq

    Outputs a sequence number of DML segments in a program.

    -uc

    Lists DML segments in a program.

2. ofcbpp

Preprocesses COPY statements regardless of the compilation.

  • Usage

    Usage : ofcbpp -i <source-file> [options]
  • Options

    Option Description

    -o <output name>

    Specifies an output file name.

    -copypath <path>

    Specifies an additional copybook path other than the copybook path set in the environment variable. Specify one option for one copybook path.

    --enable-osvs

    Preprocesses OS/VS COBOL syntax.

    --enable-rw

    Preprocesses syntax related to IBM Report Writer.

    --enable-include

    Searches the file declared as EXEC SQL INCLUDE from the directory specified by DB2INCLUDE environment variable first, then the directory specified by the OFCOBCPY and finally the current directory. The source is inserted into the directory.

    --enable-declare

    Searches the file declared as EXEC SQL INCLUDE from the directory specified by DB2INCLUDE environment variable first, then the directory specified by the OFCOBCPY and finally the current directory. The source is inserted into the directory. Adds the EXEC SQL DECLARE statement if the statement does not exist before or after the DATA DIVISION variable referenced by the EXEC SQL statement.

    --collating-seq-ebcdic

    Adds statements for setting the collating sequence to EBCDIC.

    --add-missing-period

    Adds an ending period in a sentence before a section or paragraph if it is missed. The section or paragraph must be declared in area A.

    --conv-stop-run

    Converts a STOP statement to a GOBACK statement and then preprocesses it.

    --disable-cpy-limit

    Disables the 8-character limit on the target copybook name when using the COPY statement.

    --expanded

    Performs the preprocessing supporting expanded COBOL syntax. For information about available expanded COBOL syntax, refer to "Appendix C. Expanded COBOL" in OpenFrame COBOL Language Reference Guide.

    --conv-nominal-key

    Replaces the NOMINAL KEY clause with the ORGANIZATION INDEXED clause when the --enable-osvs option is used.

3. ofcbppf

Performs preprocessing for NET COBOL compilation in ofcob.

  • Usage

    Usage : ofcbppf -i <source-file> [options]
  • Options

    Option Description

    -o <output name>

    Specifies an output file name.

    --version

    Displays the current version of ofcbppf.

    -v

    Specifies that the COBOL program has variable-length format.

    -l

    Insert a DISPLAY statement that prints the SECTION and PARAGRAPH names.

    -c <num>

    Sets the collating sequence mode for preprocessing based on the num value.

    • 0: does not perform a separate collating sequence processing (default value).

    • 1: uses the default collating sequence provided by OpenFrame AIM only when the collating sequence is not specified in the program.

    • 2: always uses the default collating sequence provided by OpenFrame AIM regardless of whether or not collating sequence is specified in the program.

    -t

    Generates code that calls callpush and callpop functions during a CALL statement execution. Use this option to pass the functions' arguments to OpenFrame.

    --resolve-console

    Enables the use of the UPON CONSOLE phrase of the DIDSPLAY statement.

    --print-rename

    Outputs variable names before and after the preprocessing.

    --user-ndb-exception

    Disables automatically generating code for processing DB EXCEPTION and DEAD LOCK during NDB statement preprocessing.

    --config-print

    Enables changing print control code generated after preprocessing MODE and CHARACTER TYPE clauses, by using a CSV config file.

    --call-assembly

    Generates code that provides parameter information during CALL statement execution so that variable_parameter_list of OFASM can be used.

4. ofcbppe

Performs preprocessing for ESQL syntax compilation in ofcob.

  • Usage

    Usage: ofcbppe -i <source-file> [options]
  • Options

    Option Description

    -o <output name>

    Specifies an output file name.

    --version

    Displays the current version of ofcbppe.

    -copypath <path>

    Specifies the directory path to COPYBOOK.

    --enable-osvs

    Performs the preprocessing supporting OS/VS COBOL syntax.

    --enable-rw

    Performs the preprocessing supporting IBM REPORT WRITER related syntax.

    --enable-varchar

    Recognizes user-declared COBOL group items as ESQL’s VARCHAR data type.

    --enable-mode-ansi

    Uses ANSI dynamic SQL. If Tibero dynamic SQL is used when this option is specified, the precompiler causes a syntax error.

    --enable-unsafe-null

    Option to allow NULL when there is no indicator variable. This option can also be used to omit an indicator variable even when NULL is expected.

    --enable-runtime-odbc

    Used to use Open Database Connectivity (ODBC).

    --enable-close-on-commit

    Closes the cursor at commit time.

    --enable-mssql

    Replaces DB2 SQL with MSSQL SQL.

    --enable-end-of-fetch-100

    Specifies SQLCODE to return to a user as 100 in END-OF-FETCH after SQL statement execution.

    --enable-loglvl-debug

    Specifies "LOG_LVL" and "DEBUG" in esql_set_option.

    --remove-quote

    Removes quotation marks when tbdb2cblcv is used with ROWNUM.

    --disable-cpy-limit

    Disables the 8-character limit on the target copybook name when using the COPY statement.

    1. Since ofcbppe refers to ESQL Parser provided by Tibero, Tibero client must be installed to preprocess ESQL syntax. Install Tibero client by referring to Tibero Installation Guide, and then confirm that there is libtbeparser.so in client/lib of TB_HOME.

    2. For versions prior to ofcbppe-1.0.34, use --runtime-odbc instead of --enable-runtime-odbc. For more information, use the --help option.

5. ofcbppd

Performs preprocessing for DB2 syntax compilation in ofcob. Currently, ofcbppd only creates the comp_swap function for handling endian of host variables declared as COMP.

  • Usage

    Usage: ofcbppd -i <source-file> [options]
  • Options

    Option Description

    -o <output name>

    Specifies an output file name.

    --version

    Displays the current version of ofcbppd.

    -copypath <path>

    Specifies the directory path to COPYBOOK.

    --enable-osvs

    Performs the preprocessing supporting OS/VS COBOL syntax.

    --enable-rw

    Performs the preprocessing supporting IBM REPORT WRITER related syntax.

    --oracle

    Enables ORACLE database.