# Structured SAVE

> Source: https://manual.pvxplus.com/pxplus-user-guide/development-tools/error-handling-and-debugging/structured-save

By setting the **['SS'](https://manual.pvxplus.com/parameters/ss)** system parameter, you can verify the logical integrity of decision and loop structures automatically each time you **[SAVE](https://manual.pvxplus.com/directives/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](https://manual.pvxplus.com/directives/case)** or **[DEFAULT Directives](https://manual.pvxplus.com/directives/default)** outside of a **[SWITCH](https://manual.pvxplus.com/directives/switch)** / **[END SWITCH](https://manual.pvxplus.com/directives/end-switch)** structure.

The following sets of directives are checked for structural integrity:

|  |  |
| --- | --- |
|  | **[FOR..NEXT](https://manual.pvxplus.com/directives/for)** |
|  | **[WHILE..WEND](https://manual.pvxplus.com/directives/while)** |
|  | **[REPEAT..UNTIL](https://manual.pvxplus.com/directives/repeat)** |
|  | **[IF..THEN..ELSE](https://manual.pvxplus.com/directives/if)** |
|  | **[SWITCH..CASE](https://manual.pvxplus.com/directives/switch)** |
|  | **[SELECT..FROM..NEXT RECORD](https://manual.pvxplus.com/directives/select)** |

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](https://manual.pvxplus.com/directives/next)** as opposed to a **[WEND](https://manual.pvxplus.com/directives/wend)**.

Note:  
There will be no attempt to decipher the logic to determine if a [GOTO](https://manual.pvxplus.com/directives/goto) might make the logic work.

## See Also

**[Programming Constructs](https://manual.pvxplus.com/pxplus-user-guide/programming-constructs/introduction)**
