INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Retrieving the number of records

Retrieving the number of records

(OP)
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!

RE: Retrieving the number of records

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.

RE: Retrieving the number of records

2
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.

RE: Retrieving the number of records

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.

RE: Retrieving the number of records

(OP)
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).

RE: Retrieving the number of records

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

RE: Retrieving the number of records

I should add the web address of the support request page.

RE: Retrieving the number of records

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).

RE: Retrieving the number of records

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

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close