An error is any condition that prevents the compiler from performing the requested operation. The user errors detected by the schema and subschema compilers fall into two major categories:
The compilers check for both kinds of errors at the same time.
Syntax errors are those caused when you violate a clause's format rules (such as a misspelled keyword).
When you submit a statement as input, the compiler examines the statement, word by word, expecting specific combinations of keywords and expressions. This process is known as parsing the syntax.
The compiler expects a sentence to begin with a verb and end with a period. Words that can follow the verb vary, depending on the verb; words that can follow a component name vary, depending on the component type; and so on. If the compiler parses a clause or subclause successfully (that is, if keywords and expressions fall in the expected order), the compiler attempts to apply that clause. If not, the compiler processes the error.
Logic errors are those caused when a syntactically correct clause requests an operation that is not practicable (such as a request to modify a nonexistent component).
When the DDL compiler attempts to satisfy a specific request, it may find that the request is not logical. When trying to determine the cause of a logic error, you should consider the following possibilities:
Some logic errors are not detected when the statement is processed. Check for interdependence of components occurs when the VALIDATE statement is executed.
The following example shows a logic error. The first statement contains no errors; the second statement attempts to assign a record ID already assigned to a record. The compiler actions caused by the partially correct statement are shown at right.
add record department record id is 410 location mode is calc using dept-id duplicates not allowed 02 dept-id pic x(4). add record employee ◄──────────────────── Puts record in dictionary record id is 410 ◄──────────────────── Produces error messages location mode is calc using emp-id ◄──── Assigns location mode and duplicates not allowed duplicates option to record 02 emp-id pic 9(4). ◄──────────────── Associates elements with the record
After the processing is complete, the dictionary contains a partial description of the EMPLOYEE record. To complete the description, you should issue the following statement:
modify record employee record id is 411.
You can specify any record ID other than 410. Because the location mode and elements already are part of the record description in the dictionary, you would not need to recode them.
The message FORWARD SPACING TO NEXT PERIOD indicates that the compiler cannot continue processing the statement. For example, if the compiler detects an invalid password, the compiler must reject all clauses in the statement. To resume processing, the compiler searches for the end of the statement (the period) and begins with the next keyword. This message is issued when the compiler is checking either identification or security at the beginning of the statement. Consequently, no partial updates occur when this message is issued.
|
Copyright © 2014 CA.
All rights reserved.
|
|