MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
mahesh_chv Beginner Joined: 04 Aug 2005 Posts: 41 Topics: 16
Posted: Thu Apr 12, 2007 7:26 am Post subject: Matching & Non-matching records problem in Syncsort
Hello,
I have a requirement to create output file using two different files such a way that for the matching key record should come from first file. All non-matching records from both the files should come in output file.
Find below the scenario.
E.g.
File 1
523AAAAM01
524BBBBM01
525CCCCM01
File 2
523XXXXM01
523RRRRM01
524YYYYM01
526DDDDM01
Expected Output File :
523AAAAM01
524BBBBM01
525CCCCM01
526DDDDM01
Here the key field is pos 1 to pos 3. I am using below control card
SORT FIELDS=(1,3,ZD,A) --> To sort the records in ascending order
SUM FIELDS=NONE --> To remove the duplicates in output
I am getting the below output which is not expected.
523AAAAM01 --> Correct
524YYYYM01 --> Wrong!! it should be from File 1 i.e. 524BBBBM01
525CCCCM01 --> Correct
526DDDDM01 --> Correct
Please help me out!!....Also note that I have supplied huge input records !!
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu Apr 12, 2007 8:01 am Post subject:
mahesh_chv ,
you need to concatenate file 1 first in the concatenation list and also use EQUALS option so that you have the record from file1
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your file1,disp=shr
// DD DSN=your file2,disp=shr
//SORTOUT DD DSN=your output file,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
OPTION EQUALS
SORT FIELDS=(1,3,ZD,A)
SUM FIELDS=NONE
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
mahesh_chv Beginner Joined: 04 Aug 2005 Posts: 41 Topics: 16
Posted: Thu Apr 12, 2007 9:43 am Post subject:
Thanks Kolusu!
your solution worked fine.....
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum