# Is there a simple way to get the number of records in a file without a browse and a record count on the browse

**URL:** <https://clarionhub.com/t/is-there-a-simple-way-to-get-the-number-of-records-in-a-file-without-a-browse-and-a-record-count-on-the-browse/9221>\
**Category:** questions\
**Created:** [July 10, 2026, 5:34am UTC](https://clarionhub.com/t/is-there-a-simple-way-to-get-the-number-of-records-in-a-file-without-a-browse-and-a-record-count-on-the-browse/9221 "2026-07-10T05:34:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenns](https://clarionhub.com/user_avatar/clarionhub.com/kenns/32/6428_2.png) [@kenns](https://clarionhub.com/u/kenns)\
**Post date:** [July 10, 2026, 5:34am UTC](https://clarionhub.com/t/is-there-a-simple-way-to-get-the-number-of-records-in-a-file-without-a-browse-and-a-record-count-on-the-browse/9221/1 "2026-07-10T05:34:22Z")

</div>

I have learnt to determine if a file has no records, but have not been able to turn that into a process that will give a count of all records.

! Get the DataSet record  
!-------------------------

```
IF Records(DATASETS) = 0 !If no record
    LOC:Count = 0
    ! Do Stuff 
ELSE
    ! Do something to get the count (number of records) goes here
END

```

Can some kind person point me in the right direction?

Regards  
Kenn Sharples

---

<div class="post-metadata">

**Author:** ![PurpleEdge2214](https://clarionhub.com/user_avatar/clarionhub.com/purpleedge2214/32/5109_2.png) [@PurpleEdge2214](https://clarionhub.com/u/PurpleEdge2214)\
**Post date:** [July 10, 2026, 9:00am UTC](https://clarionhub.com/t/is-there-a-simple-way-to-get-the-number-of-records-in-a-file-without-a-browse-and-a-record-count-on-the-browse/9221/2 "2026-07-10T09:00:07Z")

</div>

Hi Ken,

I might be missing something but doesn’t RECORDS(filename) give you what you want?

---

<div class="post-metadata">

**Author:** ![RchdR](https://clarionhub.com/letter_avatar_proxy/v4/letter/r/d78d45/32.png) [@RchdR](https://clarionhub.com/u/RchdR)\
**Post date:** [July 10, 2026, 9:53am UTC](https://clarionhub.com/t/is-there-a-simple-way-to-get-the-number-of-records-in-a-file-without-a-browse-and-a-record-count-on-the-browse/9221/3 "2026-07-10T09:53:36Z")

</div>

> [@kenns](#):
>
> ```auto
> LOC:FilenameCount = 0
> LOC:KeyCount = 0
> 
> Open(Filename)
> 
> LOC:FilenameCount = Records(Filename)
> LOC:KeyCount = Records(FilePrefix:KeyName)
> 
> IF LOC:FilenameCount
> ! Do File Stuff
> End
> IF LOC:KeyCount
> ! Do File Key Stuff
> End
> 
> Close(Filename)
> 
> ```

The function Records() needs the file in question to be Open() before it can work.
