MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Global Temporary Table -

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
rublu
Beginner


Joined: 14 Jun 2005
Posts: 5
Topics: 2

PostPosted: Tue Jun 14, 2005 3:58 pm    Post subject: Global Temporary Table - Reply with quote

Hi all,

In one of my application, an online tranaction will invoke our main program from where we are routed to many sub modules. In one of the sub modules we are declaring Global temporary tables and using that.

There is a possibility that the before end of transaction we may invoke the module that is declaring GTT again. If that scenario occurs, the program is abending with SQLCODE -601. So I need to drop the GTT after each time i finish my business with the GTT each time. Is there any other way where I can do this wihtout droping the table as such?
_________________
------------
Ruben
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12381
Topics: 75
Location: San Jose

PostPosted: Tue Jun 14, 2005 4:14 pm    Post subject: Reply with quote

Rublu,

Use a DECLARED Temporary table instead of CREATE Global temporary table. The advantage of a declared temporary table versus a global temporary table is that information about declared temporary tables is not entered into the DB2 catalog when the table is created. This will allow two or more declared temporary tables with the same fully qualified name can exist at the same time. The name of the table only has to be unique for the thread through which the table was created. With a global temporary table, the fully qualified table name must be unique, so you either have to single-thread whatever process is going to create and reference the table, or you have to ensure that every thread will have a unique ID associated with it.

Check this link for a detailed explanation of Working with temporary tables

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/1.2.1.2?SHELF=&DT=20010710165542&CASE=

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rublu
Beginner


Joined: 14 Jun 2005
Posts: 5
Topics: 2

PostPosted: Tue Jun 14, 2005 4:31 pm    Post subject: Reply with quote

Thanks Kolusu.

I am using Declared Global Temorary table only. More than that I am getting this sqlcode -601 when I tried to Declare this GTT before the transaction ends. So I have option other than dropping the table after all the work was done with the GTT. Then I can declare again I guess?

Now my question is when I invoke this module through the same transaction whether i will get the same probelm. i.e. During the multi thread transaction, whether the instance is unique for each time when I invoke or is it unique for the transaction? Because transaction is same for this application. Ifthe instance is same for the transaction always then it is not at all possible for me to use GTT here Sad .
_________________
------------
Ruben
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12381
Topics: 75
Location: San Jose

PostPosted: Tue Jun 14, 2005 6:31 pm    Post subject: Reply with quote

rublu,

May be you are having the catalog entries from your old CREATE GTT?

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
schintala
Beginner


Joined: 18 May 2005
Posts: 108
Topics: 31
Location: USA

PostPosted: Wed Jun 15, 2005 8:12 am    Post subject: Reply with quote

I think you may consider use of terminalID while declaring the global temporary table name.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group