What is the best way to determine the number of records in a relative record file?
#VisualCOBOL
#RelativeRecord
What is the best way to determine the number of records in a relative record file?
What is the best way to determine the number of records in a relative record file?
read this relativ file in sequential mode from begin to end! for each read add 1 to counter!
What is the best way to determine the number of records in a relative record file?
Hi Bob,
You can start the file at the end and then do a read previous and the relative key field will contain the number of records in the file.
open input test-file
move 999 to rel-key
start test-file key is <= rel-key
read test-file previous record
display "num recs = " rel-key
goback.
read this relativ file in sequential mode from begin to end! for each read add 1 to counter!
Thanks
Hi Bob,
You can start the file at the end and then do a read previous and the relative key field will contain the number of records in the file.
open input test-file
move 999 to rel-key
start test-file key is <= rel-key
read test-file previous record
display "num recs = " rel-key
goback.
I wanted to avoid reading through the file and wondered if there is something built in that provided this information. Your suggestion is a great compromise solution. Thanks.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.