View previous topic :: View next topic
|
Author |
Message |
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
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 |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Abin,
Would you please lets us know what do u mean by key3 ? |
|
Back to top |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
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 |
|
|
Sundar V
New User
Joined: 25 Apr 2006 Posts: 5
|
|
|
|
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 |
|
|
abin
Active User
Joined: 14 Aug 2006 Posts: 198
|
|
|
|
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 |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
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 |
|
|
|