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

Compare 2 files


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

New User


Joined: 12 Dec 2012
Posts: 3
Location: India

PostPosted: Tue Dec 18, 2012 11:24 pm
Reply with quote

I want to achieve the below scenario:

I need to compare current days file with the previous days file and create one output file with the following details:

1) Records present in file1 and not in file2--Records are added. Write File1 records in output file with indicator A at the end.
2) Records present in file2 and not in file1--Records are deleted. Write File2 records in output file with indicator D at the end.
3) Key is same in File1 & File2 but other value changed--Records are modified. Write File1 records in output file with indicator C at the end.

Example :

Key (1,6)
LRECL of both files are 30.

File1

Code:
EEEEEE TTTT
FFFFFF JJJJ
VVVVVV LLLL



File2
Code:
EEEEEE TTTT
FFFFFF HHHH
GGGGGG RRRR
LLLLLL UUUU



OUTPUT
Code:
FFFFFF HHHH C
GGGGGG RRRR A
LLLLLL UUUU A
VVVVVV LLLL D


Hope the requirement is clear, appreciate your help!!.

Regards,
Purva
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Dec 19, 2012 12:18 am
Reply with quote

what is the sort product you have in your shop??
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Wed Dec 19, 2012 2:13 am
Reply with quote

Purva,

Your example output doesn't match with your requirement.

Quote:
1) Records present in file1 and not in file2--Records are added. Write File1 records in output file with indicator A at the end.
2) Records present in file2 and not in file1--Records are deleted. Write File2 records in output file with indicator D at the end.
3) Key is same in File1 & File2 but other value changed--Records are modified. Write File1 records in output file with indicator C at the end.


It should be

Code:
FFFFFF JJJJ C
GGGGGG RRRR D
LLLLLL UUUU D
VVVVVV LLLL A


Sort Card:

Code:
 SORT FIELDS=COPY                                         
 JOINKEYS F1=IN1,FIELDS=(1,6,A)                           
 JOINKEYS F2=IN2,FIELDS=(1,6,A)                           
 JOIN UNPAIRED                                           
 REFORMAT FIELDS=(F1:1,11,?,F2:1,11)                     
 INREC  IFTHEN=(WHEN=(12,1,CH,EQ,C'1'),                   
        BUILD=(1:1,11,12:C' A')),                         
        IFTHEN=(WHEN=(12,1,CH,EQ,C'2'),                   
        BUILD=(1:13,11,12:C' D')),                       
        IFTHEN=(WHEN=(12,1,CH,EQ,C'B',AND,               
                      8,4,CH,NE,20,4,CH),                 
        BUILD=(1:1,11,12:C' C'))                         
 OUTFIL FNAMES=SORTOUT,                                   
 OMIT=(12,1,CH,EQ,C'B')   


Output:

Code:
FFFFFF JJJJ C
GGGGGG RRRR D
LLLLLL UUUU D
VVVVVV LLLL A   


Note: I used DFSORT
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Dec 19, 2012 3:55 am
Reply with quote

Same question today on another site. Didn't you like what was suggested there?
Back to top
View user's profile Send private message
purbasha

New User


Joined: 12 Dec 2012
Posts: 3
Location: India

PostPosted: Wed Dec 19, 2012 12:27 pm
Reply with quote

Thanks Sai,

Its working.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Dec 19, 2012 10:51 pm
Reply with quote

Hello,

If you persist in using the "shotgun" approach (posting the same question on multiple sites), you will be banned from posting on this site.

Most of us helpers here are helpers on the other sites. . .

d
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 4
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