Skip to main content

[archive] VISION Record Count

  • June 5, 2009
  • 7 replies
  • 0 views

[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

7 replies

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

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

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

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

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

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

[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
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