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

compare two files on fields with different declarations


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madishpa

New User


Joined: 18 May 2007
Posts: 28
Location: Hyderabad

PostPosted: Fri Aug 12, 2011 1:16 pm
Reply with quote

I need to compare two files on field with different declarations.

field on which files is to be compared is amount.

Input file1:

lrecl - 80, recfm - fb

Amount is first 8 bytes in first file . declaration is 9(5).9(2)


Inut file2 :

lrecl - 80, recfm - fb

Amount is first 5bytes in second file , declaration is s9(5)v9(2) comp-3.


If the amount in file1 matches with file2 , then record should be written to output file from first file

Output file :

Lrecl - 80 , recfm - fb

Could you please provide dfsort job for the above requirement.

Thanks
Madishpa
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Aug 12, 2011 1:22 pm
Reply with quote

Quote:
Could you please provide dfsort job for the above requirement.

Hi, What have you done to approach the requirement? & where are you having difficulty.. If you are stuck somewhere then we would be glad to help in resolving.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Aug 12, 2011 3:53 pm
Reply with quote

Please post some sample input data and sample output data....
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Aug 12, 2011 5:26 pm
Reply with quote

madishpa,
Do you have any other key fields that you can use (along with amount field) to match records from both the files? Using amount as a key field to match 2 files, makes your job more vulnerable to have many to many match, in which case you would end up with more number of matched record than present in your File1.

However, see if below works...
Code:
//STEP0001 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTJNF1 DD DISP=SHR,DSN=INPUT FILE1 FB/80
//SORTJNF2 DD DISP=SHR,DSN=INPUT FILE1 FB/80
//SORTOUT  DD DSN=OUTPUT FILE FB/80         
//SYSIN DD *                                 
  JOINKEYS FILE=F1,FIELDS=(01,7,A)           
  JOINKEYS FILE=F2,FIELDS=(01,7,A)           
  REFORMAT FIELDS=(F1:1,80)                 
  OPTION COPY                               
/*                                           
//JNF2CNTL DD *                             
  INREC BUILD=(1:1,4,PD,TO=ZD,LENGTH=07)     
/*                                           

Thanks,
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Aug 12, 2011 5:31 pm
Reply with quote

madishpa wrote:
Inut file2 :

lrecl - 80, recfm - fb

Amount is first 5bytes in second file , declaration is s9(5)v9(2) comp-3.



s9(5)v9(2) comp-3 would be 4 bytes not 5.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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
Search our Forums:

Back to Top