Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merging files using SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Mon Mar 24, 2008 10:06 pm    Post subject: Merging files using SYNCSORT
Reply with quote

Hi,

I'm using SYNCSORT FOR Z/OS 1.2.2.2R. My requirement is as follows.

I have two files. First file is sorted under Key1. Second file is sorted under Key2.
I need to merge the two files under Key3.

So if input is as follows.

File#1:
111aaa
222bbb
333ccc

File#2:
111x111
111x222
333y555

The output should come as
111aaa
111x111
111x222
222bbb
333ccc
333y555

Could some body please help me on this.

regards,
Abin davis Peter.
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Mon Mar 24, 2008 10:56 pm    Post subject:
Reply with quote

Hi Abin,

Would you please lets us know what do u mean by key3 ?
Back to top
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Mon Mar 24, 2008 11:01 pm    Post subject:
Reply with quote

Sorry,

I missed to mention one important point. In output the records from file#1 should be in the order of its appearance in the input and records from file#2 shich matches with records in file#1 in key#3(here it is 1:3) should appear right after the matching file#1 record in the original order.
Back to top
View user's profile Send private message
Sundar V

New User


Joined: 25 Apr 2006
Posts: 5

PostPosted: Tue Mar 25, 2008 1:25 pm    Post subject:
Reply with quote

Hi abin

Pls try as below, I hope it may help you.

//EXAMP JOB A492,PROGRAMMER
//MERGE EXEC PGM=SORT
//SYSOUT DD SYSOUT=A
//SORTIN01 DD DSN=A123456.MASTER,DISP=SHR (Your Input file: 1)
//SORTIN02 DD DSN=A123456.NEW,DISP=SHR (Your Input File: 2)
//SORTOUT DD DSN=A123456.SORT.SAMPOUT,DISP=OLD (Resultant File: File 3)
//SYSIN DD *
MERGE FIELDS=(1,6,CH,A,1,7,CH,A)
/*

All, please correct me if my suggestion is wrong.

Thanks and Regards
Sundar
Back to top
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Tue Mar 25, 2008 1:54 pm    Post subject:
Reply with quote

Hi Sundar,

If we use merge operator files should be in the sorted order of merge fields. But my input files are in different sorted order. That is File#1 is in sorted order of Ke#1 and File#2 on Key#2. And Key#1 != Key#2. I need to retain the input order in the output also.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Tue Mar 25, 2008 6:58 pm    Post subject:
Reply with quote

Hi Abin,
Please chek the below code.

Code:


//PS020    EXEC PGM=SORT                   
//SYSOUT   DD  SYSOUT=*                     
//TOOLMSG  DD  SYSOUT=*                     
//DFSMSG   DD  SYSOUT=*                     
//SORTIN   DD  DSN=your First FILE,DISP=SHR     
//         DD  DSN=your Secnd FILE,DISP=SHR     
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD  *                           
   SORT FIELDS=(1,3,CH,A),EQUALS           


Code:


OUTOUT (SORTOUT):
111aaa 
111x111
111x222
222bbb 
333ccc 
333y555




Thanks
Krishy
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 Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us