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 2 files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Compare 2 files
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

Moderator


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

PostPosted: Wed Dec 19, 2012 12:18 am    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Dec 19, 2012 3:55 am    Post subject: Reply to: Compare 2 files
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    Post subject: Reply to: Compare 2 files
Reply with quote

Thanks Sai,

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

Site Director


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

PostPosted: Wed Dec 19, 2012 10:51 pm    Post subject: Reply to: Compare 2 files
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    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 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
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm


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