Author: vnktrrd
Subject: Reply to: How to split the records using the amount field
Posted: Mon Oct 31, 2016 10:32 am (GMT 5.5)
Hi Bill,
For example I have give that record. My file contains many of such records with key and amount fields. And amount is not a fixed one. If the amount is greater than 250000 then we should go for split. Else we will write one record and proceed to next. Also, if the amount split goes beyond 10 records then we will write 10 split records in the first file and another record with rest of the amount is written to second file.
Input file
Output file-1
Output file-2
[/code]
Subject: Reply to: How to split the records using the amount field
Posted: Mon Oct 31, 2016 10:32 am (GMT 5.5)
Hi Bill,
For example I have give that record. My file contains many of such records with key and amount fields. And amount is not a fixed one. If the amount is greater than 250000 then we should go for split. Else we will write one record and proceed to next. Also, if the amount split goes beyond 10 records then we will write 10 split records in the first file and another record with rest of the amount is written to second file.
Input file
Code: |
12345 3000000 12346 2000000 12347 2500000 12348 250000 |
Output file-1
Code: |
12345 250000 12345 250000 12345 250000 12345 250000 12345 250000 12345 250000 12345 250000 12345 250000 12345 250000 12345 250000 12346 250000 12346 250000 12346 250000 12346 250000 12346 250000 12346 250000 12346 250000 12346 250000 12347 250000 12347 250000 12347 250000 12347 250000 12347 250000 12347 250000 12347 250000 12347 250000 12347 250000 12347 250000 12347 250000 12348 250000 |
Output file-2
Code: |
12345 500000 |