You can change the behavior of the compiler, and enforce certain rules, by specifying compiler options. Using compiler options allows you to identify and fix issues in your code, making your code unambiguous and more robust. Rules you can specify include requiring full table and field names, fully qualified buffer references, full keywords, and return values for user-defined functions, non-VOID methods, and property getters. You can optionally specify a severity level (warning or error) for each type of option.

Option name Description
require-full-names All table and field names must appear as they are in the schema. The compiler's ability to implicitly resolve abbreviated table names is disabled.
require-field-qualifiers All buffer references (including database tables, temp-tables, and buffers) must be fully qualified. The compiler's ability to implicitly resolve the buffer to which a field reference refers is disabled.
require-full-keywords All ABL language keywords must be fully spelled out.
require-return-values In user-defined functions, non-VOID methods, and property getters, all logical code paths must have RETURN value statements. For more information, see Require-return-values compiler option.

Setting the severity level for a compiler option

There are two possible severity levels which can be set by the user: warning or error. The warning level produces a message for each violation, but allows the compilation to complete successfully, provided that the only violations are related to the option. The error severity level produces a message for each violation and prevents the compilation from completing successfully. If you specify an option without a severity level, the default is warning. If you don't specify a compiler option, then no violation checking is performed for that option.

To set a severity level, append a colon (:) to the option name, followed by the severity level:

option-name:severity-level
option-name
Valid values are require-full-names, require-field-qualifiers, require-full-keywords, or require-return-values.
severity-level
Valid values are warning or error.
For example, the following are possible ways to specify severity levels for the require-return-values compiler option:
require-return-values

require-return-values:warning

require-return-values:error

Ways to set compiler options

There are four different ways to set compiler options, which are described below. The first two ways use the COMPILE statement. The third way uses the COMPILER system handle, and the fourth way uses the -compileroptionsfile startup parameter.
  1. The OPTIONS phrase on the COMPILE statement.
    When compiling a file in ABL, use the OPTIONS phrase to specify the desired compiler options. Separate each option with a comma, and enclose the list in quotes. For example:
    COMPILE basic.p OPTIONS "require-full-names:error,require-field-qualifiers:error".
    For more information on the OPTIONS phrase, see the COMPILE statement.
  2. The OPTIONS-FILE phrase on the COMPILE statement.
    When compiling a file in ABL, use the OPTIONS-FILE filename phrase on the COMPILE statement to specify the name of a file that contains the options. filename should be an absolute path or a path relative to PROPATH. For example:
    COMPILE basic.p OPTIONS-FILE myCompilerOptions.
    The options file is a plain text file. Anything between a hash tag (#) and the end of line in the file is treated as a comment. The compiler options must be separated by commas even if on different lines. For example:
    # myCompilerOptions
    require-full-keywords, # no severity specified; warning is the default
    require-full-names:error,
    require-field-qualifiers:error,
    require-return-values:warning
    For more information on the OPTIONS-FILE phrase, see the COMPILE statement.
  3. The OPTIONS attribute on the COMPILER system handle.
    Before compiling a file in ABL, set the OPTIONS attribute on the COMPILER system handle. For example:
    COMPILER:OPTIONS = "require-return-values:warning".
    COMPILE basic.p.
    COMPILER:OPTIONS = "".   // reset to no compiler options
    
  4. The -compileroptionsfile startup parameter.

    When starting up the ABL client, use the -compileroptionsfile startup parameter, to specify a file containing the options. This sets the OPTIONS attribute to the values in the file.

    -compileroptionsfile filename
    The file is the same format as described in the second method for the OPTIONS-FILE phrase of the COMPILE statement. For more information on this startup parameter, see Compiler Options File (-compileroptionsfile).