We're writing a new Cobol-DB2 stored procedure which has to return lot of data.
The data layout for my result-set is something as follows:
05 Static Data
05 Static Data10
05 Group 1 occurs 0 to 3 times depending on numItems
10 Group 1 variables
10 Group 1 variables
10 Group 2 occurs 0 to 10 times depending on numChars
Note: Since, it is a pretty big layout I am just giving a glimpse of how the layout is.
For a single call, the stored procedure may have multiple records with the above layout. So, let us say if the Input is Employee ID, I may have to return 2 records for that Input - one for the manager and the other for the employee. Sometimes, the hierarchy may go beyond the manager as well.
This stored procedure will be accessed by a Websphere program.
Now, I am thinking of returning the results in XML format. I do not want to store the output result-set in DB2 and hence I am not using the Db2 in-built XML functionalities. The reason is that this stored procedure may be called more than 10000 times in a day and I may never be requiring the I/O data. So, it will be pretty costly to save the I/O data in XML format in Db2. Hence, I want to process and return the output using a global-temp table.
Hence, I am planning to do the following:
1. Retrieve the data from various application tables and put the data in the above copybook layout
2. Use the COBOL XML Generate statement to generate the XML tags
3. Create a global-temp table with column type as CLOB. Insert the XML data in a CLOB column and then return the result-set to the calling system.
However, DB2 V10 for z/OS does not support CLOB column type in Global Temp table nor it supports the XML column type. So, I am stuck in the above plan.
There is another option for me - I can declare an O/P parm in the Stored Procedure for a CLOB/BLOB type variable and string all the XML result-sets (employee+manager) and pass the result-set using the CLOB/BLOB type. But that will limit the number of result-sets because the maximum length one result-set can be around 35000 bytes.
split the data structure into multiple cursor's and let front end manage to prepare matrics as needed to display on the screen.
Something like a metadeta cursor and detailed data cursor. If I understand you rightly.