IBM Mainframe Forum Index
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in

Sending Large data in a Stored Procedure

IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: :: View next topic  
Author Message

New User

Joined: 09 Apr 2008
Posts: 83
Location: Chennai

PostPosted: Wed Oct 23, 2013 9:20 am
Reply with quote

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:
01 Result-Set
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.

Is there any other option which I can take?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator

Joined: 21 Sep 2010
Posts: 2502
Location: NY,USA

PostPosted: Fri Dec 13, 2013 5:41 am
Reply with quote

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.
Back to top
View user's profile Send private message
Ed Goodman

Active Member

Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Fri Dec 13, 2013 9:21 pm
Reply with quote

I admit to being confused...

You don't want to store the data in DB2, so you're going to make a temp table?

Isn't a temp table still a table? Or are those now stored in memory?

You might call it 10000 times a day, but not need the output? If you don't need it, then why are you storing it every time?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2
Page 1 of 1


Search our Forum:

Similar Topics
Topic Forum Replies
No new posts How to find which file contains my se... DFSORT/ICETOOL 6
No new posts Changing Data Type SYNCSORT 4
No new posts Copying data from prev record using SORT SYNCSORT 19
No new posts how to get total count from numeric d... SYNCSORT 9
No new posts Map a data element to SPACES if it is 0 COBOL Programming 2

Back to Top