Error Handling and Debugging

Structured SAVE

 

By setting the 'SS' system parameter, you can verify the logical integrity of decision and loop structures automatically each time you SAVE a modified program. This feature checks programs in logical forward sequence to see if a start-of-structure block finishes in order with the correct matching end-of-structure directive. This also validates that there are no CASE or DEFAULT Directives outside of a SWITCH / END SWITCH structure.

The following sets of directives are checked for structural integrity:

 

FOR..NEXT

 

WHILE..WEND

 

REPEAT..UNTIL

 

IF..THEN..ELSE

 

SWITCH..CASE

 

SELECT..FROM..NEXT RECORD

If a logical error occurs (e.g. FOR with no corresponding NEXT), the process will result in a Warning #125: Improper Structure Detected that indicates the line where the fault was detected.

Example:

0010 BEGIN
0020 FOR I = 1 to 40
0030 ..... 
0040 WEND

The resulting report would indicate the start of the structure block at line 20 and mark the detection point at line 40, since it should have encountered a NEXT as opposed to a WEND.

Note:
There will be no attempt to decipher the logic to determine if a GOTO might make the logic work.

See Also

Programming Constructs