@SASJedi. Hope this will help. 1.The data depends on flags and limits to generate new fields as well as accumulated values. 2. Amount is displayed in Pay_C if flag is C1 - C3. Amount is displayed in Pay_1 if flag is M. 3. The data has the limit for C1 - C3. Example, C1 - C3 are limits id 173 . i.e. if the row has Flag is C1 and Amount is 40, then id 173 will have Pay_C to be 20 since the maximum limit is 20 for C1. If Amount was to be 15 then Pay_C would have been 15 Since it amount doesn't exceed the limit of C1 =20. 4. The data has the limit for PAY1 as well. Example if PAY1 limit is 1000 and and amount is 300, then PAY1 will be 300. If the amount is 1200, then PAY1 will be 1000 with a remainder of 200 which will be used to calculate PAY2. If cumulative sum of PAY1 exceeds the limit, the PAY1 will be zero. For instance row 2 from the data will have 300 under PAY1 since the flag is M. Since row 3 has amount 1300 and flag M, the remaining amount needed to meet the PAY1 limit will be 700 and hence PAY1 will be 700. The remaining 600 will be used to calculate PAY2 (600 * 0.1 =60. Note: use PAY2_DEC). Since PAY1's LIMIT is met, any row after that with flag M will have PAY1 to be zero, unless there is a negative (credit). Also Pay2 has a limit as well. If there is a negative amount then the code should check all previous amount to see if there is an exact positive amount and negate its pay_c, pay1 and pay2. Example, row 3 and 5 are just negative difference. If cumulative sum of total amount meets 2000 (max_pay) then any pay after should be zero unless a negative amount has been introduced to change the limit met. The total_pay will be sum of pay_c , pay1 and pay2. Since calculations depend on accumulated
... View more