Highlighted
Absent Member.
Absent Member.
457 views

[archive] VISION Record Count

[Migrated content. Thread originally posted on 04 June 2009]

Is there a softer, easier way of getting a record count on a file outside of doing a call to vutil, redirecting the output, then reading the results? I have 1 program where I redirect a call to vutil32 -i to a text file, then parse it, then delete the temporary text file, but this is an annoying thing to have to do. Is there a different way? I looked all over the documentation and searched the forum, but this is the only method I came across.

Thanks,
-Chris
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] VISION Record Count

You can use the I$IO library routine.
Attached is an old sample program that I think I got from AcuCorp.
It's a character based program so it might be easier to compile it in debug mode and walk it through to see it work.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] VISION Record Count

We do this in several areas of our code, especially for a progress bar.

You'll need filesys.def in the code.


           SET OPEN-FUNCTION TO TRUE.
           MOVE 254          TO MAX-REC-SIZE.
           MOVE 254          TO MIN-REC-SIZE.
           MOVE 5            TO NUM-KEYS.
           MOVE Finput       TO OPEN-MODE.
           CALL "I$IO" USING IO-FUNCTION, IMV-FILENAME, OPEN-MODE,
                       LOGICAL-INFO.
           IF RETURN-CODE = ZERO
              DISPLAY MESSAGE BOX
              "Could not open file, error code = ", F_ERRNO
              EXIT PROGRAM
           END-IF
           MOVE RETURN-CODE        TO FILE-HANDLE.
      * Now get the record count
           SET INFO-FUNCTION       TO TRUE.
           SET GET-RECORD-COUNT    TO TRUE.
           CALL "I$IO"    USING IO-FUNCTION, FILE-HANDLE, INFO-MODE,
                          RECORD-COUNT-INFO.
           IF E-NO-SUPPORT
              DISPLAY "File system cannot determine record count"
              SET CLOSE-FUNCTION   TO TRUE
              CALL "I$IO" USING IO-FUNCTION, FILE-HANDLE
              MOVE ZEROS             TO WS-NO-IMV-RECS
           ELSE
              MOVE NUMBER-OF-RECORDS TO WS-NO-IMV-RECS
           END-IF
           SET CLOSE-FUNCTION      TO TRUE.
           CALL "I$IO"    USING IO-FUNCTION, FILE-HANDLE.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] VISION Record Count

We use something like this:



...

           select visionfile  assign to visionfile-name
                  organization       is binary sequential,
                  access mode        is sequential
                  file status        is fstat.

...

       fd  visionfile.
       01  visionfile-record.
           05 filler                   pic x(02).
           05 vf-vision-version        pic x(2) usage comp-x.
              88 vision-3              value 3.
              88 vision-4              value 4.
              88 vision-5              value 5.
           05 filler                   pic x(508).
       01  visionfile3-record.
           05 filler                   pic x(38).
           05 vf3-active-records       pic 9(09) comp-x.
           05 vf3-deleted-records      pic 9(09) comp-x.
           05 filler                   pic x(48).
           05 vf3-max-rec-size         pic 9(04) comp-x.
           05 vf3-min-rec-size         pic 9(04) comp-x.
       01  visionfile4-record.
           05 filler                   pic x(50).
           05 vf4-active-records       pic 9(09) comp-x.
           05 vf4-deleted-records      pic 9(09) comp-x.
           05 filler                   pic x(56).
           05 vf4-max-rec-size         pic 9(04) comp-x.
           05 vf4-min-rec-size         pic 9(04) comp-x.
       01  visionfile5-record.
           05 filler                   pic x(60).
           05 vf5-active-records       pic 9(09) comp-x.
           05 vf5-deleted-records      pic 9(09) comp-x.
           05 filler                   pic x(79).
           05 vf5-max-rec-size         pic 9(09) comp-x.
           05 vf5-min-rec-size         pic 9(09) comp-x.

...

       77  visionfile-name             pic x(40) value spaces.
       77  fstat                       pic xx    value spaces.
       01  w-helpfields.
           05 w-active-records         pic 9(09) comp-x.
           05 w-deleted-records        pic 9(09) comp-x.
           05 w-max-rec-size           pic 9(04) comp-x.
           05 w-min-rec-size           pic 9(04) comp-x.

...

              move file-name to visionfile-name
              open input visionfile

              move spaces to visionfile-record
              read visionfile end-read

              evaluate true
                when vision-3
                     move vf3-active-records  to w-active-records
                     move vf3-deleted-records to w-deleted-records
                     move vf3-max-rec-size    to w-max-rec-size
                     move vf3-min-rec-size    to w-min-rec-size
                when vision-4
                     move vf4-active-records  to w-active-records
                     move vf4-deleted-records to w-deleted-records
                     move vf4-max-rec-size    to w-max-rec-size
                     move vf4-min-rec-size    to w-min-rec-size
                when vision-5
                     move vf5-active-records  to w-active-records
                     move vf5-deleted-records to w-deleted-records
                     move vf5-max-rec-size    to w-max-rec-size
                     move vf5-min-rec-size    to w-min-rec-size
              end-evaluate

              close visionfile

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.