Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Join Keys and DB2 Query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
jackare

New User


Joined: 27 Aug 2008
Posts: 32
Location: Brazil

PostPosted: Sat Feb 13, 2016 5:57 am    Post subject: Join Keys and DB2 Query
Reply with quote

Hi,
Can I run a DB2 query and a "JOIN UNPAIRED" in the same Sort Step? Could show me an JCL example ?
Thanks a lot!
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sat Feb 13, 2016 12:39 pm    Post subject: Reply to: Join Keys and DB2 Query
Reply with quote

Since you have SyncSORT, why don't you just try it?
Back to top
View user's profile Send private message
jackare

New User


Joined: 27 Aug 2008
Posts: 32
Location: Brazil

PostPosted: Mon Feb 15, 2016 7:20 am    Post subject: Re: Reply to: Join Keys and DB2 Query
Reply with quote

Bill Woodger wrote:
Since you have SyncSORT, why don't you just try it?


Bill,

In a single step using a DB2 query would be like this

Code:

//SORTSQL  EXEC PGM=SYNCSORT,PARM='DB2=DSN'                 
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,20)                     
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,20)                     
//SORTDBIN DD *
  SELECT COD_PRODUCT, NAME_PRODUCT
  FROM DB2LST.PRODUCT
  WHERE STATUS = 'P';
/*                                             
//SORTIN   DD DUMMY                                         
//SORTOUT  DD DSN=<output dataset name>,                       
//         DISP=(,CATLG,DELETE),                     
//         LRECL=80,RECFM=FB,BLKSIZE=0,           
//         SPACE=(CYL,(500,50),RLSE),MGMTCLAS=WORKM     
//SYSOUT   DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
/*



So how to code in the same step the "SORTJNF1" with the result of the DB2 query and "SORTJNF2" with another sequential file previously generated in another JOB ?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 pm
No new posts Joinkeys with duplicated keys juares castro SYNCSORT 19 Fri Sep 23, 2016 5:58 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us