Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compare two files using SYNCSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Compare two files using SYNCSORT
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: 2284
Location: @my desk

PostPosted: Sun Mar 20, 2011 2:21 pm    Post subject:
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    Post subject: Reply to: compare two files using SYNCSORT
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: 73
Location: Boston

PostPosted: Mon Mar 21, 2011 6:02 pm    Post subject:
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: 73
Location: Boston

PostPosted: Mon Mar 21, 2011 6:16 pm    Post subject:
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    Post subject: Reply to: compare two files using SYNCSORT
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    Post subject: Reply to: compare two files using SYNCSORT
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    Post subject: Added extra to figure out content from which file
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: 73
Location: Boston

PostPosted: Wed Mar 23, 2011 10:59 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us