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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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