When you increase cnt-A-subsidy, your array Subsidy increases, changing the length of your record, causing your data to overwrite. This will get worse as the other indexes increase such as count-A-provis increase during processing. Might need to break these into multiple working records.