Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving the number of records 2

Status
Not open for further replies.

Luixx

Programmer
Sep 12, 2008
2
PT
Hi,

How can I know the number of records in an indexed file?

(I'd like to have a progress bar.) (Liant Cobol runtime 11)

Thanks!
 
The only way I know to find the number of records in the
RM Cobol Indexed file is to use the recovery utility which
displays the number of records in the file before it attempts to rebuild the indexes.
 
There was once a Liant utility called RMRECS.COB that did exactly that job. I don't know if it exists now in their site. If there aren't any license issues I could attach it here.

Hope it helps.

Theophilos.

-----------

A few weeks of trial and error can spare you lots and lots of minutes reading the manual.
 
You can also try the following:
Code:
      ******************************************************************
      *           Find Number of records in an indexed file            *
      ******************************************************************
       Identification Division.
       Program-Id.    Num-Of-Recs.
       Author.        Theophilos Kanoutas.

      ******************************************************************
      *            E N V I R O N M E N T    D I V I S I O N            *
      ******************************************************************
       Environment   Division.
       Configuration Section.
       Special-Names.
           Decimal-Point Is Comma.

       Input-Output  Section.
       File-Control.
           Select                     Idx-Fil
                  Assign To Disk      Idx-Path
                  Organization Binary Sequential Access Sequential
                  File Status         FlSt.

      ******************************************************************
      *                    D A T A    D I V I S I O N                  *
      ******************************************************************
       Data Division.
       File Section.
       Fd  Idx-Fil.
       1   Idx-Rec.
           2                   Pic x(50).
           2   Idx-Num-Recs    Pic 9(9)    Binary(4).
           2                   Pic x(10).
      *----------------------------------------------------------------*
       Working-Storage Section.
       1   Idx-Path            Pic x(255).
       1   FlSt                Pic xx.
       1                       Pic x.
        88 Error-On-File           Value "Y" False "N".
       1   Chr                 Pic x.

      ******************************************************************
      *                 P R O C E D U R E   D I V I S I O N            *
      ******************************************************************
       Procedure Division.
       Declaratives.
       Dcl-Idx-Section Section.
           Use After Standard Error Procedure On Idx-Fil.
       Dcl-Idx.
           Set Error-On-File To True.
       End Declaratives.
      *----------------------------------------------------------------*
       Main Section.
       Procedure-Division.
           Display   Spaces Erase
           Accept    Idx-Path Tab Prompt No Beep

           Set       Error-On-File To False
           Open      Input Idx-Fil
           If        Error-On-File
             Display "Error " FlSt " Opening File"
             GoBack
           End-If
           Set       Error-On-File To False
           Read      Idx-Fil
           If        Error-On-File
             Display "Error " FlSt " Reading File"
             GoBack
           End-If
           Close     Idx-Fil
           Display   "Number Of Records:" Idx-Num-Recs Convert
           Display   "Press Enter"
           Accept    Chr Col 0
           GoBack
           .
       End Program Num-Of-Recs.

Theophilos.

-----------

A few weeks of trial and error can spare you lots and lots of minutes reading the manual.
 
Wooow! thank you very much Theophilos. That is just PERFECT!!

It's just magic!

I've been searching in their site all around, google, yahoo, etc and found nothing about RMRECS.COB

This solution is even better, it's perfect!

I've wanted it for like 2 or 3 years!

Thank You Again!

If there is anything I can do, just ask!

Luis (PT).
 
Luis,

Micro Focus (Liant) support could have provided that utility to you for the asking, and still can.

Just go to the support web page and enter a support request. It has recently been updated to return error information.



Tom Morrison
 
In the header of the index or relative file, there is information about the file like key descriptions, & counts of alive records & deleted records.

If you read the file as binary file,
position 47-54 contain the number of records in the file (format: pic 9(12) comp-4).
 
RM/Cobol includes the "rmmapinx" utility which also gives the record count, as well as a whole lot of other information about an indexed file. See Appendix G in the RM/Cobol Users Guide.

The program Theotflyos is pretty nice, but personally, I would tend to avoid homegrown solutions like that in case the underlying implementation is changed by the vendor.

Code what you mean,
and mean what you code!
But by all means post your code!

Razalas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top