Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods DFSORT/ICETOOL 5 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us