Third Question is an interesting question. And from COBOL stand point of view - it should be doable, though, I've never tried it. But the rather burning question I'd like to ask is -- why do you want to do this?

I have a requirement to fetch values from various tables. and the count is not constant. Hence i used temporary table in stored procedure and fetched all the values and populated in temp table and opened the cursor.

But this SP is hit many times like 5000- 10000 times. Hence 5000 times the SP is creating and dropping the table.Hence the total time take by the outer task is multiplied.

I thought with a fixed copybook i will create a file in the place of temp file.
If it is possible .. (This program is called online hence dynamic) .