NET/MASTER Network Control Language (NCL) Reference Manual
&SYS.ERROR.KEYWORD
System Variables
5–22 106126 Tandem Computers Incorporated
&SYS.ERROR.KEYWORD
The &SYS.ERROR.KEYWORD system variable contains the keyword that caused the
error. This system variable is set to null unless the statement that caused the error was
a verb, and the syntactic error was related to a keyword.
This system variable can be used only in an ON error handler.
&SYS.ERROR.KEYWORD
Consideration
See also the other &SYS.ERROR system variables.
Example
The following example is a procedure named ONPROC that contains an error. The
error handler displays information that can help you isolate the error. It displays the
contents of &SYS.ERROR.KEYWORD, which identifies the wrong keyword in the
statement:
ONPROC: PROCEDURE
ON ERROR DO
WRITE DATA="AN ERROR OCCURRED IN KEYWORD",
&SYS.ERROR.KEYWORD,
"OF STATEMENT" &SYS.ERROR.STMT_NAME,
"AT POSITION " &SYS.ERROR.STMT,
"IN LINE " &SYS.ERROR.LINE
RESUME
END
&COL=OOPS
WRITE COLOR=&COL DATA="THIS IS TEST TEXT"
END ONPROC
In the previous example, the color option (&COL variable) is incorrect.
&SYS.ERROR.KEYWORD contains the value &COL, which is displayed by the ON
error handler. The ON error handler is also coded to display:
1. The statement that contains the error, which is the WRITE statement
(&SYS.ERROR.STMT_NAME).
2. The line number (&SYS.ERROR.LINE) in which the error occurs.
3. The statement number (&SYS.ERROR.STMT) within the line that contains the error.