Posted: Wed Jun 22, 2005 9:53 pm Post subject: comparing 2 files and picking fields with values
Hi,
I searched the forum before posting but could not find a correct match.
I have 2 input files with the same layout. Example :
Input file 1:
Fields and records :
Code:
100 AB 130 10 1 27.20 AAAAA 11110
101 AB 230 20 1 33.33 BBBBB 11101
101 AB 330 23 2 55.50 BBBBB 11101
101 AB 430 30 1 101.10 BBBBB 11101
101 AB 530 10 1 15.10 BBBBB 11101
102 AB 330 25 1 20.10 CCCCC 11201
102 AB 630 15 1 10.10 CCCCC 11201
input file 2:
Fields and records:
Code:
100 AB 130 10 1 27.20 0.09 10
101 AB 230 20 1 33.33 0.50 20
101 AB 330 23 2 55.50 0.43 25
101 AB 530 32 1 15.10 0.01 10
102 AB 330 15 1 20.10 0.90 30
Output file:
Fields and records:
Code:
100 AB 130 10 1 27.20 AAAAA 11110 0.09 10
101 AB 230 20 1 33.33 BBBBB 11101 0.50 20
101 AB 330 23 2 55.50 BBBBB 11101 0.43 25
101 AB 430 30 1 101.10 BBBBB 11101
101 AB 530 10 1 15.10 BBBBB 11101 0.01 10
102 AB 330 25 1 20.10 CCCCC 11201 0.90 30
102 AB 630 15 1 10.10 CCCCC 11201
I am expecting the output as above. If I can get the above output as two different files, where one file will have all the matching records and the other file has non matching records should also be fine.
The AID, ATYP, APD, ASZ, AQT, AAMT are key fields on which the 2 input files are sorted. We are using Syncsort in our shop. I am sure there might be options with DFSORT, but I would like the solution in Syncsort.
I did see in this forum the basic syncsort JCL used for comparing 2 files and producing a matching and non-matching output.
I am more looking closer into merging the fields of the matching records. I hope I have made myself clear. Please let me know what approach I could use to get an output as above in Syncsort.
I did see that I did not provide the field values. Therefore I replied to the message indicating the fields.
As mentioned previously,
the input file 1 has the following fields
AID, ATYP, APD, ASZ, AQT, AAMT AADDR AZIP APCT AUNIT.
I have mentioned the values in this order for the input file1. But Input file1 will have blanks/zeroes for the APCT and AUNIT fields.
the input file 2 has the following fields
AID, ATYP, APD, ASZ, AQT, AAMT AADDR AZIP APCT AUNIT.
In the case of input file 2 the AADDR and AZIP files will have blanks.
The output file layout has the following fields
AID, ATYP, APD, ASZ, AQT, AAMT AADDR AZIP APCT AUNIT.
Please note again, I have mentioned the records in the field order as above for all the files.
The LRECL is actually 318 and RECFM is FB. I have given only certain field values, which are of importance and required for the solution.
Joined: 26 Nov 2002 Posts: 12383 Topics: 75 Location: San Jose
Posted: Fri Jun 24, 2005 5:23 am Post subject:
geetha001,
There are a couple of errors in your posts.
1. You can only have 2,4,8 bytes for binary fields on SUM FIELDS. You coded 40 as length which is invalid. you need to split them in the multiples of 2/4/8 bytes.
2. You really don't need a Seqnum since you have the key fields.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum