The record in the file are grouped based on the first 6 bytes. If its same, then the values will be written consecutively until the first 6 bytes changes.
The 31st byte has a 5 byte varible whose presence will be checked in the file2. If its present, then the value should be changed as xxxxx and then the same is written in the file1.
For example, consider the value X0006 from file1 and its also present in file2. so while writing this record, the value X0006 should be changed as XXXXX and the each such value will have 2 records A & B.
Now if there are more than one X0006 records, then all those A & B values have to be added and displayed as a single record. This condition is applicable for all the records present in file2.
In this 'B' record stands for the percentage. It will have the percentage value of the previous 'A' record.
For Example: The 'A' record has '45.5' which is the total value. The next 'B' record has the '100' due to the previous 'A' record is the total. ((45.5/45.5)*100) = 100.
The Next 'A' record has the value of '19.0' Where the 'B' record value should be ((23.5/45.5)*100), that is 51.6.
In the same way, we are adding the value of 'A' records whole fields (in position 31-35) is present in file2. We need the percentage of the previous 'A' record in the record 'B'.
Example: ((23.0/45.5)*100), that is 50.5 should be present in 'B' record.
Now i have given example for 'AAAAA', In the same way we should do for 'BBBBBB' and so on till end of the file.
For more example please refer the precious output file which is posted first.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
nelson pandian,
Your requirement is quite confusing. lets take the example of just 1 key
Code:
AAAAAA X0002 45.5 A
AAAAAA X0002 100.0 B
AAAAAA X0006 19.0 A
AAAAAA X0006 41.7 B
AAAAAA X0005 23.5 A
AAAAAA X0005 51.6 B
AAAAAA X0006 4.0 A
AAAAAA X0006 8.8 B
Since x0006 has a matching key the values of A are summed up
Code:
AAAAAA X0002 45.5 A
AAAAAA X0005 23.5 A
AAAAAA XXXXX 23.0 A
now tell me how do you want the B records for this 3 records
for X0002 record it is (45.5 /45.5 ) * 100 = 100.0
now for the second record (23.5/45.5) * 100 = 51.64
now for thrid record (23.0/(45.5 + 23.5)) * 100 = (23.0/69.0) * 100 = 33.33
is that how you calculate ? if not you need to come up with a detailed explanation of how you want the percentage to be calculated
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
nelson.pandian,
Basically you want to re-calculate the percentage on the B record only when there is match and you summed up the values and you need to consider the very first record in the Group to calculate the percentage? If so then the following DFSORT/ICETOOL JCL will give you the desired results.
We don't have the latest version of DFSORT/ICETOOL Features (July, 2008). The version we are using right now is Z/OS DFSORT V1R5 So i think, i cont use this JCL
Can you suggest some other way to meet my requirement?
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
nelson.pandian,
It would probably require another pass. Is the B record different from the A record or can we use the A record as base and create the B record calculating the percentage?