I am not able to find why a S0C6 problem ocurs . The main program ABC123 and subprogram ABCPDT(dynamic call). We also generated the plan and package for both the programs.
The S0C6 problem arises when ABCPDT is trying to read a table TABPARM table. The program tries to read this table for PARAM_KEY with the value AB200711. The value is generated by the program itself which is a prohibited date.
The program fails while making the following call which corresponds to TABPARM table.
CALL "DSNHADDR" USING SQL-AVAR-ADDRS1 IN
SQL-AVAR-LIST4 PARAM-DATA OF DCLTABPARM SQL-NULL.
Not sure, if it could be a access problem. I found that the same table is read successfully inside the main program ABC123.
ERROR : The system detected a specification exception (System Completion Code=0C6).
From compile unit ABCPDT at entry point ABCPDT at compile unit offset +475EC8B9 address 780AE71.