Try OpenEdge Now
skip to main content
New Information
OpenEdge ABL : COMPILE OPTIONS phrase improvements
 

COMPILE OPTIONS phrase improvements

This release allows you to choose whether errors or warnings are displayed for COMPILE OPTIONS phrase rule violations. Prior to this release, if a violation occurred, the compiler would display the error and stop the compilation. Now, by specifying a severity level, you can control whether warnings are displayed, which do not prevent compilation, or errors, which do stop compilation. If no severity level is specified the default is Warning.
The following ABL syntax has been updated to specify the severity level for the COMPILE OPTIONS phrase:
OPTIONS options-list | OPTIONS-FILE { options-file | VALUE ( expression )}
One or more rules are enforced during compilation. In the case of OPTIONS, the rules are specified by a character expression that evaluates to a comma-separated list of options. In the case of OPTIONS-FILE, the rules are specified in the same way, but supplied in a designated file.
The possible options are described in the following table:
Option
Description
require-full-names[:Error |:Warning ]
All table and field names must appear as they are in the schema. The compiler’s ability to implicitly resolve abbreviated names in tables is disabled.
Optionally set severity level to Warning or Error.
require-field-qualifiers[:Error |:Warning ]
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.
Optionally set severity level to Warning or Error.
require-full-keywords[:Error |:Warning ]
All language keywords must be fully spelled out.
Optionally set severity level to Warning or Error.
Note that the severity level specifies what happens when there is a failure:
*Error generates a message for each failure, and prevents the generation of r-code.
*Warning generates a message for each failure, but allows the generation of r-code, provided that the only failures during compilation are related to the option. (Other types of failure can prevent r-code generation.)
*If no severity level is specified, the default is Warning.
For example, the following COMPILE statement enforces full table and field names, and fully qualified references with different severity levels.
COMPILE myproc.p OPTIONS "require-field-qualifiers:Error,require-full-names".
The code below shows access of a field with a fully qualified reference, followed by unqualified and abbreviated examples of the same statement. Only the first statement compiles without error if the code is compiled using the statement above.
/* Accessing the field "tcfield" in the table "tbhelper" */

tbhelper.tcfield = "doUpdate".

/* The following will not compile with "require-field-qualifiers:Error"
in effect. */

tcfield = "doUpdate".

/* The following compiles with "require-full-names" with default severity level
in effect but warning messages are generated. */

tbh.tcf = "doUpdate".
If options-list or the contents of the options-file resolve to the empty string ("") or white space only, then no options are applied. If options-list or the contents of the options-file resolve to the Unknown value (?), then the compiler ignores the OPTIONS or OPTIONS-FILE phrase. If an option listed is not valid, the compile statement fails with an error. When compiling a class hierarchy, the options set in the COMPILE statement are applied to all files compiled for the hierarchy.
You can also set these options using the OPTIONS attribute of the COMPILER system handle, which can be initialized with the Compiler Options (-compileroptionsfile) startup parameter. (See OpenEdge Deployment: Startup Command and Parameter Reference for more information.) Options set using the OPTIONS or OPTIONS-FILE in the COMPILE statement override any options set in the OPTIONS attribute of the COMPILER system handle (unless options-list or the contents of the options-file resolve to the Unknown value (?), as described above).
Note: OPTION-FILE supports the use of the hashtag (#) to include comments in the options file. See the Compiler Options (-compileroptionsfile) startup parameter in OpenEdge Deployment: Startup Command and Parameter Reference for an example.