During a program run, the error message Perform Stack Overflow occurred.
This error message normally indicates that an AcuCOBOL-GT program exceeded the number of levels PERFORM statements can be nested within paragraphs or sections. A PERFORM statement is nested if the statement contains a PERFORM statement against another paragraph/section. This error can occur if a PERFORM statement did not exit properly.
By default, the amount of nesting allowed by the runtime is set to 128. That is, 128 PERFORM againstg a paragraph/section that contains a PERFORM statement against another paragraph/section. This value can be increased by setting the runtime variable PERFORM_STACK to a higher value in the configuration file.
If a paragraph/section is not exited correctly, the perform stack will not clear down properly. Normally the end of a section is marked by the EXIT verb and the end of a paragraph is marked by another paragraph name (for example by a GO TO verb). If the program is not exiting a paragraph/section correctly, then the perform stack will not decrease.
Ways to check this include obtaining a trace file with "paragraph tracing" with the debugger command "tp" , another is to run the program through the debugger and in the debugger type the command "vp" which displayes the current perform stack for the debugged program. This will help determine if paragraphs/sections are being exited correctly.
It is also possible that this error is being caused by memory corruption - a common cause of this is subscripts going out of bounds. By default the runtime does not do any array bound checking which can cause memory to be over-written that shouldn't be.
The -Zr compiler option allows for recursive PERFORM statements. When this option is used, the PERFORM verb is modified so that return addresses are stored on a stack. Only the most recent PERFORM statement has an active return address. When this option is used, a paragraph under the control of a PERFORM statement may (directly or indirectly) PERFORM itself. For more information, see your AcuCOBOL-GT user guides. Additionally the -Zr1 or -Zr0 compiler options can be used.
Array bounds checking can be turned on by compiling the program with the "-Za" flag. This will then force the runtime to check that the subscript for an array is correct and will abort if it isn't.