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 

Unload using Joins from DB2 table

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


Joined: 22 Aug 2006
Posts: 4
Topics: 2

PostPosted: Sun May 13, 2007 8:02 am    Post subject: Unload using Joins from DB2 table Reply with quote

Hi..

Is it possible to use Join in UNload utility while extracting data from DB2 tables as below? KEY1 being common in both tables. This syntax fails saying select is invalid. Can u suggest any options if there is?
Code:

//DSNUPROC.SYSIN DD   *                                 
 UNLOAD DATA                                             
 FROM TABLE table1                           
  WHEN ( KEY1 IN (SELECT KEY1 FROM TABLE2
                            WHERE KEY2 = 'XYZ'));
Back to top
View user's profile Send private message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 317
Topics: 50
Location: Germany

PostPosted: Mon May 14, 2007 1:27 am    Post subject: Reply with quote

vijay_bc,

create a view with the desired unload condition and do the unload using the view.

bauer
Back to top
View user's profile Send private message
CZerfas
Intermediate


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Mon May 14, 2007 6:23 am    Post subject: Reply with quote

You should use the keyword WHERE instead of WHEN.

regards
Christian
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon May 14, 2007 6:48 am    Post subject: Reply with quote

vijay_bc,

Use DSNTIUAL utility to unload the tables instead of the DB2 Unload utility. You can join up to 256 tables

Quote:

You should use the keyword WHERE instead of WHEN.


CZerfas,

The syntax used by oP is correct for DB2 unload utility which is explained here

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNUGH13/2.27?DT=20020826194002

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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