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

SORT Query to cross join of all records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sibi Yohannan

New User


Joined: 15 Apr 2009
Posts: 47
Location: Bangalore

PostPosted: Mon Jul 20, 2009 3:04 pm
Reply with quote

Hi,
I want to create an output file that has the cross join of all records from the first file to the second. I have two files FB of length 5 bytes each.

Input file 1
11111
22222
33333

Input file 2
AAAAA
BBBBB

Output file
11111AAAAA
11111BBBBB
22222AAAAA
22222BBBBB
33333AAAAA
33333BBBBB

Can this be done using sort?
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon Jul 20, 2009 8:08 pm
Reply with quote

Here is a SyncSort for z/OS job that will do what you asked:
Code:
//STEP1 EXEC PGM=SORT                       
//SORTIN  DD DSN=INPUT.FILE1                 
//SORTOUT DD DISP=(NEW,PASS),DSN=&&TEMP1   
//SYSOUT  DD SYSOUT=*                       
//SYSIN   DD *                               
   SORT FIELDS=COPY                         
   OUTREC OVERLAY=(6:C' ')                 
//*****************************************
//STEP2 EXEC PGM=SORT                       
//SORTIN  DD DSN=INPUT.FILE2                 
//SORTOUT DD DISP=(NEW,PASS),DSN=&&TEMP2   
//SYSOUT  DD SYSOUT=*                       
//SYSIN   DD *                               
   SORT FIELDS=COPY                         
   OUTREC OVERLAY=(6:C' ')                 
//*****************************************
//STEP3  EXEC PGM=SORT                       
//SORTJNF1 DD DSN=&&TEMP1,DISP=(OLD,DELETE)
//SORTJNF2 DD DSN=&&TEMP2,DISP=(OLD,DELETE)
//SORTOUT  DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//SYSIN    DD *                               
   JOINKEYS FILES=F1,FIELDS=(6,1,A)         
   JOINKEYS FILES=F2,FIELDS=(6,1,A)         
   REFORMAT FIELDS=(F1:1,5,F2:1,5)         
   SORT FIELDS=COPY                         
/* 
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top