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

Multi row using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mallik4u

New User


Joined: 17 Sep 2008
Posts: 75
Location: bangalore

PostPosted: Tue Jul 22, 2014 11:46 am
Reply with quote

Hi,

I have following requirement:

Input File1:
ACCT1, 123
ACCT2, 124

Input File2:
ABC
BBC

Output:
ACCT1, ABC, 123
ACCT1, BBC, 123
ACCT2, ABC, 124
ACCT2, BBC, 124

As of now we are planning to write a COBOL program for this task. But we would like to know is there any SORT feature with which we can accoplish.
Please note that there is no common field in these files.

Thanks,
Mallik
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Tue Jul 22, 2014 12:23 pm
Reply with quote

More than one way.

How many records are on the second file?
Back to top
View user's profile Send private message
mallik4u

New User


Joined: 17 Sep 2008
Posts: 75
Location: bangalore

PostPosted: Tue Jul 22, 2014 12:32 pm
Reply with quote

Thanks for the quick reply.

I have 600 records in first file. In the second file i have 800 records.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Tue Jul 22, 2014 1:02 pm
Reply with quote

So you want to end up with 4.8m records?

You do a JOINKEYS. With JNF1CNTL extend the record to have a fixed one-byte value of (it doesn't matter what). With JNF2CNTL extend the other record to have the same fixed new value. They need not be in the same position.

Then do the JOINKEYS on that value. Every record on file 1 will be matched to every record on file 2. You use your REFORMAT statement to format the data how you want. Done.
Back to top
View user's profile Send private message
mallik4u

New User


Joined: 17 Sep 2008
Posts: 75
Location: bangalore

PostPosted: Tue Jul 22, 2014 1:55 pm
Reply with quote

Is it possible to match 1 record from File1 with all records in File2 using JOINKEYs?
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Tue Jul 22, 2014 2:19 pm
Reply with quote

Code for you...
As Bill mentioned you need to overlay a space in both the input file while doing the join with datasets. In the below example 13,1 has spaces already hence I didn't overlay.

Code:

 //S1   EXEC  PGM=SORT                             
 //SYSOUT DD SYSOUT=*                               
 //SORTJNF1 DD *                                   
 ACCT1, 123                                         
 ACCT2, 124                                         
 //SORTJNF2 DD *                                   
 ABC                                               
 BBC                                               
 //SORTOUT DD SYSOUT=*                             
 //SYSIN    DD *                                   
   OPTION COPY                                     
   JOINKEYS FILE=F1,FIELDS=(13,1,A),SORTED,NOSEQCK 
   JOINKEYS FILE=F2,FIELDS=(13,1,A),SORTED,NOSEQCK 
   REFORMAT FIELDS=(F1:1,7,F2:1,5,F1:8,3)           
 //JNF2CNTL DD *                                   
   INREC OVERLAY(4:C', ')                           
 //*                                                         


Hope this helps.
Back to top
View user's profile Send private message
mallik4u

New User


Joined: 17 Sep 2008
Posts: 75
Location: bangalore

PostPosted: Tue Jul 22, 2014 2:44 pm
Reply with quote

Thank you very much Bill & Magesh for your time and help.
This solution works for us.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts SYNCSORT/ICETOOL JOINKEYS SORT Statem... DFSORT/ICETOOL 3
No new posts Installing sort utilities on hercules... DFSORT/ICETOOL 4
This topic is locked: you cannot edit posts or make replies. Sort card help to prepare status report DFSORT/ICETOOL 13
No new posts Building a sort key DFSORT/ICETOOL 3
No new posts Very Large Sort failed - Seeking reco... DFSORT/ICETOOL 7
Search our Forums:

Back to Top