|PL/1 DB2 Program ABEND S0C1|
|Written by Philip L Yuson|
PL/1 program accessing DB2 ABENDs with S0C1. Compile, Link and Bind were successful. Program ABENDs when moving some fields into the DB2 control variables. The code that does this was generated by the SQL Precompiler. When variables were removed from the program and only the SQL statement was left, the program executed without problems.
Normally, 0C1 is caused by writing to an unopened file. But this was strange because there were no files that had to be written and the only I/O was to DB2. A few discussion with our technical guy pointed to PL/1 compiler not actually generating data areas of variables if they are not being used. For some reason, this messes up the program during execution. I was led on a wrong path because someone suggested that I had to initialize all variables in the PL/1 program. I thought that this was not solution because if it was, then a lot of people would have complained.
Another option was to look at the parameters during the compile. I added the INIT parameters during the compile and still no success. Tried the STATIC(FULL) option and still no success.
Left without any other option, I stripped off all variables and ran the program only with the SQL statement. The program executed the SQL statement without any problem. I then slowly added a bunch of variables until I hit the one that caused the ABEND.
Quite a pain to do, but was finally able to isolate the problem and more importantly, fix it.