Compilation

This section describes compilation methods, command options, and error messages.

1. Compilation Methods

OpenFrame PL/I compiles the PL/I source code to create a shared library to be used in OpenFrame.

The following are the three compilation methods available in OpenFrame PL/I:

  • Static Linking

    Static linking is used to compile multiple files into a single shared library.

    Use the -l option when compiling to set the directory that contains the INCLUDE file to an inc directory under the current directory.

    The following is an example of compiling file1.pli, file2.pli, and file3.pli into a libtest.so file:

    ofpli file1.pli file2.pli file3.pli -o libtest.so -I./inc
  • Dynamic Linking

    Create a new shared library by linking an external shared library when compiling a source file.

    The following is an example of creating libfile.so by linking libtest.so which is located in $OFPLI_HOME/lib:

    ofpli file.pli -o libfile.so -L$OFPLI_HOME/lib -ltest -I./inc
  • Dynamic Loading

    Create a shared library by dynamically loading a source file at the runtime when compiling it. During dynamic loading, the library does not have to be linked. Note that dynamic loading is disabled for a called function that is dynamically determined.

    The following is an example of compiling file.pli into a libfile.so by using dynamic loading:

    ofpli file.pli -o libfile.so -U

2. Compilation Command

The following describes how to use the ofpli compilation command.

  • Usage

    ofpli source files ... [command options...]
    • Source files

      Files to compile.

    • Basic compile command options

      Option Description

      -o file name

      Sets an output file.

      -I <dir>

      Sets an INCLUDE directory.

      -MI <dir>

      Sets an INCLUDE directory to be used by the %INCLUDE statement.

      -SI <dir>

      Sets an INCLUDE directory to be used by the EXEC SQL INCLUDE.

      -l <library>

      Connects to a shared library.

      -L <dir>

      Sets a library path.

      -O0, -O1, -O2, -O3

      Sets an optimization level. The lower the number, the faster the compilation but the compiled file may run slowly because it will be less optimized.

      -U

      Enables the dynamic load function.

      -dli

      Adds the DLITPLI interface. (IMS exclusive)

      -change old:new

      Changes an external entry name from "old" to "new".

      -g

      Specifies that compilation results contains debug information to use for source-level debugging.

      -fixeddec31

      Sets the maximum precision for FIXED DECIMAL to 31.

      -trace

      Displays trace information about the start and end, parameters, and return values of a procedure.

      -trace-flow

      Displays trace information at the beginning and end of a procedure.

      -trace-param

      Displays trace information about parameters.

      -trace-return

      Displays trace information about return values.

      -rule-margin-w

      Displays an error message when a non-blank character is detected that is not part of the source code.

      -rule-margin-s

      Displays an error message when a non-blank character is detected that is not part of the source code.

      -system mvs, cics, ims

      Sets a runtime environment to run a PL/I program. (Default: mvs)

      -h

      Displays help.

      -help-esql

      Displays help for ESQL preprocessor.

      --version

      Displays the current version information of OpenFrame PL/I.

      -license

      Displays license information for OpenFrame PL/I.

      -enable-esql

      Enables ESQL preprocessor.

      -tibero

      Executes ESQL preprocessor on Tibero. Must be used in conjunction with the -enable-esql option.

      -oracle

      Executes ESQL preprocessor on Oracle. Must be used in conjunction with the -enable-esql option.

      -enable-cics

      Enables CICS preprocessor.

      -enable-ofasm

      Enables ASM calls via OpenFrame ASM.

      -enable-scan-sjis

      Enables Shift-JIS recognition. Cannot be used in conjunction with the -enable-scan-extascii option.

      -enable-scan-extascii

      Enables Extended-ASCII recognition. Cannot be used in conjunction with the -enable-scan-sjis option.

      -disable-inc-limit

      Disables file length limit in an %INCLUDE statement.

      --save-temps

      Saves the temporary files created during compilation.

      The following are the temporary files created by using the command option:

      • .mp: macro preprocessing result file created when SQL or CICS preprocessor is enabled

      • .pp: preprocessing result file

      • .bc: compilation result file

      • .o: assembly result file

    • ESQL preprocessing command options

      Option Description

      -close-on-commit

      Automatically closes the cursor after a commit.

      -end-of-fetch (1403 | 100)

      Sets a SQLCODE to return to the user at an END-OF-FETCH state after executing a SQL statement. (Default value: 1403)

      -insert-no-data-error

      "no data found" error occurs for INSERT and SELECT statements.

      -prefetch N

      Prefetches N number of rows when a cursor is opened.

      -no-select-error

      An error occurs when the actual query returns more rows than given by the preprocessor due to causes like host variable.

      -unsafe-null

      Allows a NULL value when indicator variable is missing.

3. Compilation Error Messages

OpenFrame PL/I outputs error messages when an error occurs during compilation.

The following is a sample error format:

SAMPLE.pli 6:11: OFPLI1009 [S] Syntax error.

[File name]: SAMPLE.pli
[Position of code]: 6:11
[Error number]: OFPLI1009
[Error type]: [S]
[Error message]: Syntax error.
Item Description

File name

Name of the file where the error occurred.

Position of code

Line and column numbers where the error originated from.

Error number

Error number.

Error type

  • [I] (Information): useful information under normal compilation circumstances.

  • [W] (Warning): errors that do not affect program execution but may cause undesired results. Compilation executes normally.

  • [E] (Error): general error that may cause compilation to fail or cause issues during program execution.

  • [S] (Severe): fatal error that causes compilation to fail.

Error message

Error description.