A handle to information on a preceding COMPILE statement.

Syntax

COMPILER [ :attribute ]
attribute
Specifies an attribute of the COMPILER system handle.

Attributes

CLASS-TYPE attribute ERROR attribute ERROR-COLUMN attribute
ERROR-ROW attribute FILE-NAME attribute FILE-OFFSET attribute
HANDLE attribute INSTANTIATING-PROCEDURE attribute MULTI-COMPILE attribute
NUM-MESSAGES attribute OPTIONS attribute STOPPED attribute
TYPE attribute WARNING attribute

Methods

GET-COLUMN( ) method GET-ERROR-COLUMN( ) method
GET-ERROR-ROW( ) method GET-FILE-NAME( ) method
GET-FILE-OFFSET( ) method GET-MESSAGE( ) method (Handle)
GET-MESSAGE-TYPE( ) method GET-NUMBER( ) method
GET-ROW( ) method

Example

The input for the example procedure is a comma-separated list of source files. It compiles each of these procedures. If a compilation error occurs, an appropriate message is written to the compile.msgs file.

r-cmpchk.p

/* Compile a series of source files passed in a comma separated list. */
DEFINE INPUT PARAMETER sources AS CHARACTER NO-UNDO.

DEFINE VARIABLE entry-num AS INTEGER NO-UNDO.

/* If the output file already exists, delete it. If this results in an error,
   ignore the error. */
OS-DELETE "compile.msgs".

DO entry-num = 1 TO NUM-ENTRIES(sources):
  COMPILE VALUE(ENTRY(entry-num, sources)) SAVE.
  IF COMPILER:ERROR THEN DO:
    OUTPUT TO "compile.msgs" APPEND.
    MESSAGE "Compilation error in" COMPILER:FILE-NAME "at line"
       COMPILER:ERROR-ROW "column" COMPILER:ERROR-COL.
    OUTPUT CLOSE.
  END.
END.

Notes

  • If a compilation is successful, the COMPILER:ERROR attribute is set to FALSE.
  • After a COMPILE statement, check the COMPILER:ERROR and COMPILER:WARNING attributes to determine whether the compilation was successful. If the value of ERROR is TRUE, you can use the FILE-NAME to determine in which source file the error occurred. You can use either the ERROR-ROW and ERROR-COLUMN attributes or the FILE-OFFSET attribute to determine where in the source file an error occurred. You can use this information to compose a message to display or write to a log file. To find the specific error and warning messages, check the ERROR-STATUS handle.
  • The TYPE attribute returns the widget type, PSEUDO-WIDGET.

See also

COMPILE statement