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
 

 

Multi row using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Multi row using SORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Jul 22, 2014 12:23 pm    Post subject: Reply to: Multi row using SORT
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Jul 22, 2014 1:02 pm    Post subject: Reply to: Multi row using SORT
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    Post subject:
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: 159
Location: Chennai

PostPosted: Tue Jul 22, 2014 2:19 pm    Post subject: Reply to: Multi row using SORT
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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