IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare two files using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Sun Mar 20, 2011 12:21 pm
Reply with quote

Hi,

How to compare two files not based on key fields but the entire record (similar to SUPERC) and report the changes into output file using SYNCSORT?

I've two files (LRECL=948, RECFM=FB) to be compared and changes to be written to sysout of to a file.

Please help.

Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun Mar 20, 2011 2:21 pm
Reply with quote

It might help if you post the input records and the expected output. But if SUPERCE already does what you're trying to achieve why to reinvent the wheel?
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Mar 21, 2011 4:42 pm
Reply with quote

Arun,

Neither am trying to reinvent the wheel icon_lol.gif nor am that great but thought why it was not possible with SORT which has all the capabilities. I tried JOINKEYS but not with much success icon_cry.gif

Input-1:-
Code:

----+----1----+----2----+----3
ABC123 20110301 CRANES
BAT001 20101127 HILLSIDE
ACR540 20110104 PONTIAC


Input-2:-
Code:

----+----1----+----2----+----3
ABC123 20100301 CRANESS
BAS001 20101117 HILLSIDE
ACR540 20110104 PONTIAC


The first two records have changes while the third one does not have any. I would like to know how to get the before and after records into an output file using SORT also.

Output:-
Code:

----+----1----+----2----+----3
I-ABC123 20110301 CRANES
O-ABC123 20100301 CRANESS
I-BAT001 20101127 HILLSIDE
O-BAS001 20101117 HILLSIDE


Changes between 1st and 2nd set of records:
Quote:

1). Values changed at 11th and 23rd positions in 1st record.
2). Values changed at 3rd and 14th positions in 2nd record.
3). No changes for 3rd record.


Please help icon_confused.gif

Thanks.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Mon Mar 21, 2011 6:02 pm
Reply with quote

Hi,
Try this card..

Code:

//SYSIN DD *                               
  JOINKEYS FILE=F1,FIELDS=(31,1,A),SORTED   
  JOINKEYS FILE=F2,FIELDS=(31,1,A),SORTED   
  REFORMAT FIELDS=(F1:1,30,F2:1,30)         
  OPTION COPY                               
  INCLUDE COND=(1,30,CH,NE,31,30,CH)       
  OUTFIL FNAMES=SORTOUT,BUILD=(1,30,/,31,30)
//JNF1CNTL DD *                             
  INREC OVERLAY=(31:SEQNUM,1,ZD)           
//JNF2CNTL DD *                             
  INREC OVERLAY=(31:SEQNUM,1,ZD)           
/*                                         


If at all your shop does not support the JNF1CNTL and JNF2CNTL(so was my case here), try having seperate steps to introduce the sequence numbers at 31'st position on both the files and use only the SYSIN card..

Thanks,
Ashwin.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Mon Mar 21, 2011 6:16 pm
Reply with quote

I picked up your example to build the solution considering the LRECL to be 30. You would probably have to extend it for your actual record length which is 948.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Mar 21, 2011 6:55 pm
Reply with quote

Ashwin, thank.........will try and let you know.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Mar 21, 2011 7:46 pm
Reply with quote

Ashwin, thanks a lot.......... icon_biggrin.gif
Getting expected results......

Thx.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Mar 21, 2011 7:52 pm
Reply with quote

Ashwin, added a bit more to BUILD to figure from which file records are coming.......for easy comparison.

Code:

//SYSIN DD *                                               
  JOINKEYS FILE=F1,FIELDS=(31,8,A)                         
  JOINKEYS FILE=F2,FIELDS=(31,8,A)                         
  REFORMAT FIELDS=(F1:1,30,F2:1,30)                         
  OPTION COPY                                               
  INCLUDE COND=(1,30,CH,NE,31,30,CH)                       
  OUTFIL FNAMES=SORTOUT,BUILD=(C'F1-',1,30,/,C'F2-',31,30) 
/*                                                         


Thanks.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Wed Mar 23, 2011 10:59 am
Reply with quote

Thanks Ramsri for letting me know.

Thanks,
Ashwin.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top