Page 1 of 1

Display statement fixes S0C4 Abend in COBOL.

PostPosted: Wed Jul 01, 2015 10:42 am
by anurai
Hi,

I was facing a S0C4 abend while executing a conversion program for a variable file. Out of 9000 records it wrote 318 records and abended at 319th record.
I inserted a Display statement in Logic check and, to my surprise the abend got resolved.

Any idea if it's a issue with Compiler being used or something else. How can adding a Display statement in program resolve S0C4 abend?
Has anyone else encountered such issue?

Re: Display statement fixes S0C4 Abend in COBOL.

PostPosted: Wed Jul 01, 2015 12:24 pm
by BillyBoyo
Why blame the compiler? 99.99999% of the time it is the code.

In your case it is the code.

The S0C4 is likely being caused by your program code being overwritten by your program. When you put in the DISPLAY, the location of what was being overwritten changed so something causing a lesser problem (or not even manifesting itself at this point).

You need to solve the S0C4 dump. It is likely a problem with subscripting or mangled parameters to a CALL.

What was your code change immediately before the S0C4? Are you using compiler option SSRANGE?

Re: Display statement fixes S0C4 Abend in COBOL.

PostPosted: Wed Jul 01, 2015 5:57 pm
by Robert Sample
How can adding a Display statement in program resolve S0C4 abend?
This is wrong -- merely adding a DISPLAY statement did not RESOLVE the S0C4, it merely kept the S0C4 from happening. The root cause of the problem is still out there -- table being overlaid, problems with CALL arguments, or whatever -- and the problem will return if you take out the DISPLAY statement. I have seen similar problems in the past (I had a CICS program once that had an ABEND until Xpediter was used on the program, at which time the ABEND stopped happening), and you need to find / fix the root cause of the storage problem.