IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sample code: UNLOAD TABLE SPACE with INNER JOIN


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

New User


Joined: 01 Jun 2011
Posts: 5
Location: Chennai

PostPosted: Fri Nov 04, 2011 11:10 am
Reply with quote

Dear Chaps,


I would like to Unload data from two different DB2 tables by using the UNLOAD TABLESPACE Utiltiy. Is there any way to JOIN two tables using the UNLOAD Utility?.

Tables are resides in two different Table Space.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Nov 04, 2011 11:26 am
Reply with quote

You can unload the data in 2 different files... then use sort to join them...
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Fri Nov 04, 2011 12:57 pm
Reply with quote

Hi Gokula,

In my current shop, they do this extensively using BMC Unload. Just check what is available at your place.

Thanks,
Sushanth
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Nov 04, 2011 1:21 pm
Reply with quote

Is it something that you wanted to do it only with UNLOAD utility??

I would suggest make use of DSNTIAUL rather UNLOAD utility because if your job fails inbetween while using UNLOAD then your table might lock the table which might be a problem
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Nov 04, 2011 1:45 pm
Reply with quote

sushanth bobby wrote:
Hi Gokula,

In my current shop, they do this extensively using BMC Unload. Just check what is available at your place.

Thanks,
Sushanth


Hi Sushanth,

Even we have BMC installed in our shop...

How do we join two tables in different tablespaces in BMC? What is the option in BMC?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Fri Nov 04, 2011 2:47 pm
Reply with quote

Hi Gylbharat,

Below is the skeleton, try it out.
Code:
UNLOAD DIRECT NO   
SELECT columns1,columns2
FROM TABLE1, TABLE2
WHERE Table1.z = Table2.z
WITH UR;

DIRECT NO must be specified, which in the background uses DB2 Dynamic SQL to process the SELECT statement.

Thanks,
Sushanth
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Nov 04, 2011 2:59 pm
Reply with quote

Ok... Thanks sushanth...

Can you also give me a sample JCL?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Fri Nov 04, 2011 3:12 pm
Reply with quote

Gylbharat,

You shop has it means, you should be having the JCL, anyhow here is the sample
Code:
//UNLOAD01 EXEC PGM=ADUUMAIN,REGION=0M,
// PARM=(DEDR,'ADUXM01','NEW ',,'MSGLEVEL(1)')
//*********************************************************************
//         INCLUDE MEMBER=&BMCLIBR
//UTPRINT  DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSOUT   DD SYSOUT=* 
//SYSUDUMP DD SYSOUT=C 
//SYSCNTL  DD DUMMY
//SYSREC01 DD DSN=ADU.EXAMPLE1.SYSREC01,
// DISP=(,CATLG),SPACE=(TRK,(1,1)),UNIT=SYSDA
//SYSIN DD DD DISP=SHR,DSN=HLQ.TEST.JCL(BMCUL)


Thanks,
Sushanth
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Nov 04, 2011 3:41 pm
Reply with quote

Thanks Sushanth....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Load new table with Old unload - DB2 DB2 6
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top