koolspark Beginner
Joined: 27 May 2010 Posts: 29 Topics: 13
|
Posted: Mon Jul 11, 2022 4:00 pm Post subject: Read array in reverse order and remove duplicates |
|
|
hi,
We have 300 bytes VSAM KSDS file (online file, used in CICS) with Policy number, renew count, cycle date and sequence number as part of the key.
Every time the policy premium is paid, a new record is being added to this file for the policy with the bank account details and premium paid amount.
For any given policy, the last record will always have the latest premium paid information and bank details used to pay the premium.
Now, my requirement is to get all the premium payments made with unique bank account details in reverse chronological order (most recent payment details will be shown first).
I don't have the full key information & I only know policy number (partial key), so, I tried couple of ways to achieve this and but couldn't succeed.
1) I tried STARTBR (with the policy number & by moving the high values to other key fields that are unknown) & READPREV combination, but it was failing with vsam return code 16.
2) STARTBR(with policy number, moving low values to other key fields, with GENERIC option), READNEXT to read all the premium paid records & load them into working storage array. I'm successful till this point, but getting into issues while reversing the internal array and removing the duplicate bank details. if a same bank account is used to pay the premium more than once, I need to keep only the latest bank information & premium paid amount and remove the older occurrences. Can you please help? |
|