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

One to Many merge


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kris_madras

New User


Joined: 04 Jul 2005
Posts: 42

PostPosted: Wed May 28, 2025 10:34 pm
Reply with quote

I have two input files.

File-1

Code:
AAAAA
BBBBB
CCCCC


File-2

Code:
1234567

I am checking for the options to get below output file using SYNCSORT.

Output
Code:

AAAAA 1234567
BBBBB 1234567
CCCCC 1234567


While the JOIN KEYS and REFORMAT is one option but it works only on KEYS.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2218
Location: USA

PostPosted: Thu May 29, 2025 1:15 am
Reply with quote

To JOINKEYS, use any existing field with blank character from each file.

If by a chance there are no such fields, append them using INREC OVERRIDE= parameters in two //JNF1CNTL and //JNF2CNTL DD control statements.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3098
Location: NYC,USA

PostPosted: Thu May 29, 2025 4:43 pm
Reply with quote

www.ibmmainframeforum.com/syncsort-synctool/topic3351.html
ibmmainframes.com/about63621.html
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2218
Location: USA

PostPosted: Thu May 29, 2025 4:56 pm
Reply with quote

Rohit Umarjikar wrote:
https://www.ibmmainframeforum.com/syncsort-synctool/topic3351.html
ibmmainframes.com/about63621.html

This sample is too sophisticated for no reason.

Everything is much easier:
Code:
//SYSIN   DD  *
 JOINKEYS F1=FILE1,FIELDS=(6,1,CH,A)
 JOINKEYS F2=FILE2,FIELDS=(8,1,CH,A)
 REFORMAT BUILD=(F1:1,6,F2:1,8)
 SORT FIELDS=COPY
 END
//*
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3098
Location: NYC,USA

PostPosted: Thu May 29, 2025 5:00 pm
Reply with quote

Yes but point is please search as there are so many such topics discussed in past ..
I would use at least 80,1 as key if it needs that way ..
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2218
Location: USA

PostPosted: Thu May 29, 2025 8:44 pm
Reply with quote

Rohit Umarjikar wrote:
Yes but point is please search as there are so many such topics discussed in past ..
I would use at least 80,1 as key if it needs that way ..

(80,1) needs to be appended to both input files. In this particular case there is no need for this extra activity. I prefer to leave things as simple as possible.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2218
Location: USA

PostPosted: Fri May 30, 2025 7:10 pm
Reply with quote

BTW

If the real "File-2" always has only one single "record", then the same thing becomes even more trivial.

Code:
//SYSIN   DD *
 INFILE BUILD=(1,5,X,C'1234567',X)
 SORT FIELDS=COPY
 END
//*


From the initial topic absolutely no detail is clear: RECFM=? LRECL=?, for both input and output files... icon_cry.gif

If both files are unlimited in size, then even 1000 records + 1000 records input files should produce 1,000,000 output records!
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3098
Location: NYC,USA

PostPosted: Tue Jun 03, 2025 1:53 am
Reply with quote

👍Agree
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts JCL to merge two files side by side DFSORT/ICETOOL 3
No new posts SORT JCL to merge multiple tow into s... DFSORT/ICETOOL 6
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
No new posts Merge 2 input files after sort SYNCSORT 14
Search our Forums:


Back to Top