We have a COBOL program that was migrated from Bull mainframe syntax to Visual COBOL. It took some work to get it to run, because not all of the code is "optimal". It's over 17,000 lines, and calls other assemblies. We had to go away from Perform Thru using Sections in some parts, back to using GOTO to get it to run using Visual COBOL.
One of the other changes we made was to increase the stack size, using a compiler directive. Initially, we went to 200 megs (200 X 1024 X 1024) after receiving a stack overflow exception using the Visual COBOL default settings. After a couple of weekly runs, we experienced a Stack Overflow exception again. Since it was in production, and we needed the run for that night, the stack was increased to 300 megs. This happened a couple of times, until this last week it was increased to 500 megs. This has been the solution to a stack overflow without rewriting the program, which would be a daunting task. The compiler directive is this: $SET ILSTACKSIZE(524288000)
I realize that rewriting the program is the way to go. But for the time being, is there an upper limit to how big I can increase the stack size to? Is there an upper limit when this will no longer be an option?
Also, is there a way to monitor the stack size of a program, during execution? That way we might have an idea of what might be causing it, and when the stack size is getting too large and will need to be increased soon.