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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
gayathiridevi

New User


Joined: 15 Jul 2010
Posts: 8
Location: chennai

PostPosted: Thu Jul 15, 2010 5:32 pm    Post subject: compare two files
Reply with quote

I have two input files which are in sorted order. I have to compare the two input files and generate the two output files.

Note:Account is the key field.

Output1:The output file 1 contain the records from file 2 that matchs the key(account) with file1.

Output2:The output file 2 contain the records from file 2 that does not matchs the key(account) with file1.


File1:
-----
Code:
Account   Amount
---------   ---------
101          50
102          60
103          70
105          80


File2:
-----
Code:
Account   Discount   Desc
---------   ---------    ------
101          30          xxxxxx
101          40          yyyyyy
103          70          zzzzzzz
107          80          aaaaaa
108          22          bbbbbb



Output file1:
Code:
Account   Discount   Desc
---------   ---------    ------
101          30          xxxxxx
101          40          yyyyyy
103          70          zzzzzzz


Output file2:
Code:
Account   Discount   Desc
---------   ---------    ------
107          80          aaaaaa
108          22          bbbbbb



Thanks and Regards,
Gayathiri Devi
icon_redface.gif
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jul 15, 2010 10:06 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/80)
//OUT1 DD DSN=...  output file1 (FB/80)
//OUT2 DD DSN=...  output file2 (FB/80)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,3,A),SORTED
  JOINKEYS F2=IN2,FIELDS=(1,3,A),SORTED
  JOIN UNPAIRED,F2
  REFORMAT FIELDS=(F2:1,80,?)
  OPTION COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'B'),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)
/*
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


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