Thanks for the reply stolze!!
The Dynamic SQL written is building the statement, preparing it, and executing it. The query is has been declared as a cursor and opened. Since it is a SP, the cursor cannot be fetched and closed. Once opened, it should retrieve rows from table into the Result Set.
The return code for the SQL is 0 only and the table contains data that satisfies the query, however, the SP does not return result sets at all.
There is no error at all. It does not even display heading(titles) for Result Set.
What is meant by privilege handling? and how is it done differently in dynamic SQL?
The platform is z/os, COBOL program is written in Mainframe environment and DB2 Version is 8.1.
The code is first written in COBOL, compiled, linked and bound similar to any other cobol program, then is being tested thru IBM DB2 Development Center. A JCL is written to create SP DDL with 1 Result Set.
When the dynamic SQL failed to work, I tested the same program with Static SQL and found that the static SQL returns 1 result set that it should. I wish to know why the Dynamic SQL in a similar situation does not work. What else do you think I need to take care apart from the process for Static SQL? I have also included 'Dynamic Rules (Bind)' in the Bind Package for the Program.
Appreciate your help to solve this....