Skip to main content

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?


#VisualCOBOL
#RelativeRecord

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?


#VisualCOBOL
#RelativeRecord

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.