MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
yadav2005 Intermediate Joined: 10 Jan 2005 Posts: 348 Topics: 144
Posted: Thu Oct 29, 2009 9:49 am Post subject: File Compare
I have a File 1 with data as below and the fields are Account Number and Customer name.
Account number is 10 bytes and Customer Name is 20 bytes and the file is sorted by Account Number and it is FB
Code:
1111111111AAAAAAAAAAAAAAAAAAAA
1111111199BBBBBBBBBBBBBBBBBBBB
.
.
There is another file of same type with same record format with same properties of File 1
Code:
1111111111AXXXXAAAAADFSBFBDFBF
1111111112AXXXXAAAAADFSBFBDFBF
1111111199BBBBBBBBBBBBBBBBBBBB
.
.
I want an output file which will compare both files based on matching Account Numbers and if there is any change in Customer name it should give out the Account Number and status as CHANGED.
I want Changed customer names only.
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu Oct 29, 2009 10:13 am Post subject:
yadav2005,
Concatenate both files together and use the following DFSORT JCL
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your file1,DISP=SHR
// DD DSN=your file2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,10,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,10))),
IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(89:11,20))
OUTFIL INCLUDE=(11,20,CH,NE,89,20,CH),BUILD=(1,10,C'CHANGED')
//*
_________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
yadav2005 Intermediate Joined: 10 Jan 2005 Posts: 348 Topics: 144
Posted: Thu Oct 29, 2009 10:34 am Post subject:
Kolusu,
Thanks for your quick response. Sorry my mistake ,I forgot to mention I am using SYNCSORT in my shop and I know you support solutions only for DFSORT.
If you can further assist it would be great help.
Back to top
Terry_Heinze Supermod Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
Posted: Thu Oct 29, 2009 11:39 pm Post subject:
It's asking quite a bit to ask a DFSORT developer to answer a query using a competitor's product, don't you think? _________________....Terry
Back to top
papadi Supermod Joined: 20 Oct 2009 Posts: 594 Topics: 1
Posted: Fri Oct 30, 2009 1:25 pm Post subject:
Did you try the posted control statements?
If your release of Syncsort is current, WHEN=GROUP should work. _________________ All the best,
di
Back to top
Brian Wood Beginner Joined: 14 Jan 2009 Posts: 37 Topics: 0 Location: USA
Posted: Mon Nov 02, 2009 1:14 pm Post subject:
yadav2005:
Here is some simple SyncSort JOIN code that should produce the expected results:
Code: //STEP01 EXEC PGM=SORT
//SORTOUT DD DSN=...your.output
//SORTJNF1 DD *
1111111111AAAAAAAAAAAAAAAAAAAA
1111111199BBBBBBBBBBBBBBBBBBBB
/*
//SORTJNF2 DD *
1111111111AXXXXAAAAADFSBFBDFBF
1111111112AXXXXAAAAADFSBFBDFBF
1111111199BBBBBBBBBBBBBBBBBBBB
/*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(01,10,A)
JOINKEYS FILE=F2,FIELDS=(01,10,A)
REFORMAT FIELDS=(F1:1,30,F2:1,30)
SORT FIELDS=COPY
OUTFIL FILES=OUT,
INCLUDE=(11,20,CH,NE,41,20,CH),
OUTREC=(1:1,10,11:C'CHANGED',13X)
I have coded your test data "in stream" to the SORTJNF1 and SORTJNF2 DDs for purposes of this simple example. You will want to point the SORTJNF1 and SORTJNF2 DDs to your input data sets.
Please let me know if you have questions concerning the above coding solution. _________________ Brian Wood
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
yadav2005 Intermediate Joined: 10 Jan 2005 Posts: 348 Topics: 144
Posted: Fri Nov 13, 2009 10:47 am Post subject:
Thanks Brian your code worked.
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