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
 

 

SORT Query to cross join of all records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: SORT Query to cross join of all records
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: 500
Location: USA

PostPosted: Mon Jul 20, 2009 8:08 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am


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