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 

Db2 Table Unload
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Aug 05, 2008 2:17 pm    Post subject: Db2 Table Unload Reply with quote

Could anyone give me solution to below mentioned condition?

I want to use Partition Unload for a table. I have table T1 which has 50 partition today, I am doing partition unload on the table and hence it will create 50 dataset.

I am using all 50 partitioned unload datasets in the next step which is SORT. Sort step needs to take all 50 partition unload as input.

Now, let say after a month DBA decides to add 10 more partition then Unload dataset will get created but my SORT step, in which 50 datasets are hardcoded and hence it won't pick up new 10 unload partition datasets.

Questions:-

1) I thought of Unloading partitions into GDG versions but Db2 is not letting create unload datasets that are GDGs.

2) I am able to create 50 flat files, but then Everytime DBA adds partitions, I need to change my proc to include new partition datasets.

Is there a way to automate this situation?

Thanks,
Back to top
View user's profile Send private message
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Wed Aug 06, 2008 1:31 am    Post subject: Reply with quote

rajen wrote:


1) I thought of Unloading partitions into GDG versions but Db2 is not letting create unload datasets that are GDGs.


Regarding first one how are trying to create those GDG's???

Can you please post the code and error messages so that others will clear enough to solve the problem.

Regds,
Kingo
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Wed Aug 06, 2008 8:29 am    Post subject: Reply with quote

Hi Kingo,
I am creating GDG using IDCAMS

//STEP01 EXEC PGM=IDCAMS
//*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE GDG -
(NAME(MYID.TABLE.UNLOAD) -
LIMIT(60))
/*

What I meant by 1st point is after creating GDG version, when I try to submit partition unload job, DB2 is giving me error message saying.

Partitioned Unload Job :-

//SYSIN DD *
TEMPLATE UNLDDS DSN MYID.TABLE.&TS..UNLOAD(&PART)
UNIT SYSDA DISP (MOD,CATLG,CATLG)
TEMPLATE PNCHDS DSN MYID.TABLE4.&TS..P&PART..CARDS
UNIT SYSDA DISP (MOD,CATLG,CATLG)

UNLOAD DATA
PUNCHDDN PNCHDS
UNLDDN UNLDDS
FROM TABLE TABLE_NAME
SHRLEVEL CHANGE ISOLATION UR
/*


Error message which I am getting is,

DSNU049I DSNUGPRS - INVALID OPERAND '&PART' FOR KEYWORD 'TEMPLATE'
Back to top
View user's profile Send private message
kingo
Intermediate


Joined: 01 Sep 2006
Posts: 167
Topics: 40
Location: chennai

PostPosted: Wed Aug 06, 2008 8:59 am    Post subject: Reply with quote

Please try

Code:

TEMPLATE UNLDDS DSN 'MYID.TABLE.&TS..UNLOAD(&PART)'


Regds,
Kingo
_________________
IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE.
Back to top
View user's profile Send private message Yahoo Messenger
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Wed Aug 06, 2008 11:33 am    Post subject: Reply with quote

You're making the task more difficult than it needs to be. You're not unloading by partitions right now, so just drop the &PART symbolic in the TEMPLATE:

Code:
TEMPLATE UNLDDS DSN MYID.TABLE.&TS..UNLOAD
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Wed Aug 06, 2008 12:21 pm    Post subject: Reply with quote

Hi Sharon,
Thanks for suggestion but it seems like if I use TEMPLATE UNLDDS DSN MYID.TABLE.&TS..UNLOAD, then DB2 will simply do table unload, it won't do partition unload.

I may be wrong but I dont see multiple thread in db2 for unload job, rather it shows only single thread.
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Wed Aug 06, 2008 1:12 pm    Post subject: Reply with quote

rajen

Let's walk through this. You want to execute an UNLOAD by partition, and then execute a sort to combine all the individual datasets into one. What would you lose by just doing a full table unload into 1 dataset, and then just sort that 1 dataset? What you would gain is a simple, easy to understand solution to your problem. What do you think you will gain by utilizing the UNLOAD by partition? The UNLOAD performance might be a little better, but my guess is that the difference wouldn't justify a complicated solution. Try the UNLOAD both ways to see what the difference in performance really is.
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Wed Aug 06, 2008 2:50 pm    Post subject: Reply with quote

Sharon,

You caught me right. We have performance issue for ELAPSED TIME.

Currently full table unload (190 Million Records) takes about 1 hour, Since I need to reduce that time to reasonable low period, I have decided to use Partition Unload,

Now, I could have simply hardcoded Partitioned Unload Datasets in to SORT Step and it would have been an easy life but then What if DBA decides to add few more partition and I am not informed.

So, I thought it would be wise to create UNLDDDS in to GDG and then use GDG base as input for SORT so that SORT would automatically pickup all the versions(i.e. Partition Unload Dataset).

Let me know if you have some solution or if it is still not clear.

Thanks,
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Wed Aug 06, 2008 2:58 pm    Post subject: Reply with quote

You didn't address the most important issue. What is the elapsed time difference between the full table UNLOAD, and the UNLOAD by partition? Seems to me an hour isn't all that bad for 190 million rows. Also, did you try allocating additional buffers for the output dataset?
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Wed Aug 06, 2008 5:20 pm    Post subject: Reply with quote

Ok,

Partition Unload takes :- 09 Mins of Elapsed Time
Full Table Unload Takes :- 60-65 Mins of Elapsed Time

The reason for this approach is, we dont really have Elapsed Time Window and hence we decided that We should atleast try for Partition Unload if its feasible but I got stuck into above mentioned problem.

Yes, I did try allocating extra buffers as well as virtual tapes/DASD. 60-65 Mins of Elapsed Time is based on Highest Buffer allowed at our shop with DASD and its almost same for Virtual Tapes as well.

Thanks,
Back to top
View user's profile Send private message
shantharam_k
Beginner


Joined: 03 Feb 2007
Posts: 4
Topics: 0

PostPosted: Thu Aug 07, 2008 6:44 am    Post subject: Reply with quote

I think you have two round about ways:

Approach1:

1. Create a number of empty datasets (say 200)
2. Then unload the data using TEMPLATE specifying partitions into these datasets. Only some of the datasets would be used in the unload ( as many as the no of partitions).
3. In the SORT step specify all the 200 datasets. Of course, some empty datasets will participate in the SORT
4. When you feel that the no of partitions is likely to go beyond 200, u can create another 200 & so on

Approach1:

1. Run a first JCL to get the NUMPARTS in the tablespace. Using the NUMPARTS information, dynamically create a JCL that will specify the exact number of UNLOAD datasets and SORT datasets.
2. Submit the JCL created in the first step

Thanks
Shan
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Thu Aug 07, 2008 5:59 pm    Post subject: Reply with quote

Shan,

I have tried first approach but I am keeping it a side for the temp. purpose since it is associated with many unused datasets.

Would you mind throwing little more light on second approach, I am sorry but I didn't really understood the approach. How would u achieve that? Do u have sample JCL?

Thanks,
Back to top
View user's profile Send private message
shantharam_k
Beginner


Joined: 03 Feb 2007
Posts: 4
Topics: 0

PostPosted: Fri Aug 08, 2008 12:22 am    Post subject: Reply with quote

Here it is :

1. First Write a Program in REXX to get the no of Partitions in the TS by querying SYSIBM.SYSTABLESPACE (U can also run IKJEFT01 to get this using DSNTEP2 & scan the output of this to retrieve the NUMPARTS)
2. After getting the NUMPARTS, From the REXX program write the unload JCL into a PDS member. For ex. if you have 4 parts in TS, the REXX program should write the JCL in such a way that the JCL can unload into 4 datasets& sort 4 datasets.
3. Submit the dynamic JCL created (this should be achievable - for example you can do this is using the event trigger mechanism of your job scheduler. or u could also submit the JCL from the rexx program itself)

Hope this works 4 you
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Fri Aug 08, 2008 1:22 pm    Post subject: Reply with quote

So there is a significant performance advantage to unloading by partition. The only other option I can think of is to invoke the SORT from a COBOL program. You would have to dynamically allocate the unload files. Search the forum using the keywork BPXWDYN to find posts for dynamically allocating files in COBOL. You'd need to build the list of files using REXX.
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Fri Aug 08, 2008 5:18 pm    Post subject: Reply with quote

Amm..
Its kind of tricky question.

There is always improvement in terms of ELAPSED TIME since DB2 invokes Multiple Threads for unload from each partitions but this is achieved at the cost of slightly higher CPU Cost cause Multithreading.

I have used Dynamic Allocation earlier but couldnt think of generating Unload files based on this. I missed that.

Thanks for the information.

Thanks,
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
Goto page 1, 2  Next
Page 1 of 2

 
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