Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

How to know the records' number of a file ?

 
Ofery
Occasional Advisor

How to know the records' number of a file ?

Hello,

 

Is there a way to know how many records a specific RMS file (index or sequential) has ?

It can be via DCL.

 

Regards /Ofer

7 REPLIES 7
abrsvc
Respected Contributor

Re: How to know the records' number of a file ?

This sounds a little too generic to be able to answer with any confidence.  Also, info about the system is a bit lacking.  Can you please update this with at least the OpenVMS version information?

 

Also, what problem are you trying to solve?  Many applications have the ability to report record counts directly without involving either DCL or any external program.   Perhaps a description of your environment would be of assistance too.

 

Dan

Craig A Berry
Honored Contributor

Re: How to know the records' number of a file ?

There are lots of ways to do it.  One of the classic tricks is to use SEARCH/STATISTICS with an empty string:

 

$ search/statistics/nooutput sys$manager:systartup_vms.com ""

Files searched:                 1       Buffered I/O count:         9
Records searched:             467       Direct I/O count:           1
Characters searched:        16697       Page faults:               22
Records matched:              467       Elapsed CPU time:  0 00:00:00.00
Lines printed:                  0       Elapsed time:      0 00:00:00.00

 

The "records searched" tells you how many records you have.

Steven Schweda
Honored Contributor

Re: How to know the records' number of a file ?

   One possibility:

      search /nooutput /statistics <file> ""
      show symbol search$*

Hoff
Honored Contributor

Re: How to know the records' number of a file ?

As should be apparent from the previous responses, OpenVMS does not track the number of records in an RMS file as one of the available characteristics of the file; you can't query for the record count.  (There are some details you can query for that I'd be skeptical about, too, such as the longest record length.)

 

In short, open the file, read through until EOF, counting the records.  Either with your own file-reading code, or with various available tools.  This DCL about 95% of what you are looking for.  Or use SEARCH /STATISTICS, as mentioned.

 

Also FWIW, there are a number of previous discussions of this topic available within the comp.os.vms newsgroup, too — more than a few suggestions, there.  (Google itself doesn't seem to include the comp.os.vms newsgroup in its default index or gives awful ranking to the newsgroup pages, so you'll need to search the newsgroup archives from the Google Groups web page.)

Ofery
Occasional Advisor

Re: How to know the records' number of a file ?

$ search /nooutput /statistics <file> ""
$ show symbol search$*

 

What the "show symbol search$*" does ?

I tried that, but there is no such symbol.

 

Regards /Ofer

 

Steven Schweda
Honored Contributor

Re: How to know the records' number of a file ?

> What the "show symbol search$*" does ?
> I tried that, but there is no such symbol.

   Around here:

ALP $ search sys$login:login.com "" /nooutput /statistics

Files searched:                 1       Buffered I/O count:         8
Records searched:             229       Direct I/O count:           2
Characters searched:         6324       Page faults:               21
Records matched:              229       Elapsed CPU time:  0 00:00:00.00
Lines printed:                  0       Elapsed time:      0 00:00:00.02

ALP $ show symbol search$*
  SEARCH$CHARACTERS_SEARCHED = "6324"
  SEARCH$FILES_SEARCHED = "1"
  SEARCH$LINES_PRINTED = "0"
  SEARCH$RECORDS_MATCHED = "229"
  SEARCH$RECORDS_SEARCHED = "229"

 

ALP $ tcpip show version

  HP TCP/IP Services for OpenVMS Alpha Version V5.6 - ECO 5
  on a COMPAQ Professional Workstation XP1000 running OpenVMS V8.3    

> [...] Also, info about the system is a bit lacking.  Can you please
> update this with at least the OpenVMS version information?

   Still wondering.  If your SEARCH (VMS) is too old, then it may lack
some features.  With my weak psychic powers, I can only guess what will
work on your system.

Ofery
Occasional Advisor

Re: How to know the records' number of a file ?

I have Alpha VMS v6.2-H3 & the "sho sym $search*" is probably old without this feature.

Any way, the "search/statis/noout" is good anough for my needs.

 

 

Regards /Ofer