adspace
How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
Answer Posted / Mohamad Waseem
Reading the second-last record of a VSAM file without knowing the key can be challenging, but there are ways to achieve this using COBOL:
1. Set up a separate sequence set for the reverse read.
2. Set the initial record as the maximum record number (or one less than it if you want the second-last record).
3. Open the file in sequential access mode and read records in reverse order until you reach the desired record or the beginning of the file.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers