Author: Arun Raj
Posted: Mon Oct 31, 2016 8:01 pm (GMT 5.5)
vnktrrd,
As Bill has pointed out above, you can look at the SORTOUT in the SYSOUT. If you take a look at that, you will see something like below.
Each record is repeated 10 times. And an offset to be subtracted from the original amount is created in incremental amounts (column-4 above). I have used the same column to store the subtraction results. So before subtraction, column 4 will look like this
So in the example above, we need all records to output-1 as long as the subtraction result is non-negative. Plus if your subtraction result is less than the incremental amount (250000), we are writing the leftover as an additional record. Because it cannot be split further.
We need to write output-2 only when the last record computation result is non-negative. ie, when we have a valid left over amount even after the 10th iteration.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard
Posted: Mon Oct 31, 2016 8:01 pm (GMT 5.5)
vnktrrd,
As Bill has pointed out above, you can look at the SORTOUT in the SYSOUT. If you take a look at that, you will see something like below.
Code: |
12346 2000000 250000 1750000 01 12346 2000000 250000 1500000 02 12346 2000000 250000 1250000 03 12346 2000000 250000 1000000 04 12346 2000000 250000 0750000 05 12346 2000000 250000 0500000 06 12346 2000000 250000 0250000 07 12346 2000000 250000 0000000 08 12346 2000000 250000 025000} 09 12346 2000000 250000 050000} 10 |
Code: |
0250000 0500000 0750000 1000000 1250000 1500000 1750000 2000000 2250000 2500000 |
So in the example above, we need all records to output-1 as long as the subtraction result is non-negative. Plus if your subtraction result is less than the incremental amount (250000), we are writing the leftover as an additional record. Because it cannot be split further.
We need to write output-2 only when the last record computation result is non-negative. ie, when we have a valid left over amount even after the 10th iteration.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard