MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File Compare

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Oct 29, 2009 9:49 am    Post subject: File Compare Reply with quote

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.
Code:

1111111111CHANGED

I want Changed customer names only.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Oct 29, 2009 10:13 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Oct 29, 2009 10:34 am    Post subject: Reply with quote

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
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Oct 29, 2009 11:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Fri Oct 30, 2009 1:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
Brian Wood
Beginner


Joined: 14 Jan 2009
Posts: 37
Topics: 0
Location: USA

PostPosted: Mon Nov 02, 2009 1:14 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Fri Nov 13, 2009 10:47 am    Post subject: Reply with quote

Thanks Brian your code worked.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group