Example: using dynamic access with VSAM files
Suppose that you have an indexed file of employee records, and the employee's hourly wage forms the record key.
If your program processes those employees who earn between $15.00 and $20.00 per hour and those who earn $25.00 per hour and above, using dynamic access of VSAM files, the program would:
- Retrieve the first record randomly (with a random-retrieval
READ
) based on the key of 1500. - Read sequentially (using
READ NEXT
) until the salary field exceeds 2000. - Retrieve the next record randomly, based on a key of 2500.
- Read sequentially until the end of the file.