View previous topic :: View next topic
|
Author |
Message |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
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 |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Please post some sample input data and sample output data.... |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
|