skip to main content

Library Routines : S$IO

S$IO
The S$IO routine provides a low-level interface to sequential files allowing them to be managed without knowing their FD.
The routine is not affected by iscobol.file.prefix and iscobol.file.suffix configuration properties.
Syntax:
 CALL "S$IO" USING opCode 
            GIVING returnCode
Parameters:
Return code:
returnCode contains useful information such as file handles and record sizes or zero if an error occurs. Check the external variable F_ERRNO for additional information on the error.
Examples:
Example - create a sequential file, write some records and then close it
       working-storage section.
       copy "isfilesys.def".
       77  f                       handle .
       77  file-io                 pic x(128).
       01  sio-lparms.
           03 max-rec-sz pic 9.
           03 filler     pic x value ",".
           03 file-type  signed-short.
           03 filler     pic x value ",".
           03 block-sz   pic 9 value 0.
       01  rec-buffer.
           03 rec-val    pic 9(5).
           03 filler     pic x value x"00".
       procedure division.
           set s-make-function to true
           call "s$io" using sio-function, 
           if return-code = 0
              display message F_ERRNO 
                      title   "S$IO Error: make" 
           end-if           
      *opening 
           display label line 4 title "Opening file..."
           set s-open-function to true
           move foutput to open-mode
           call "s$io" using sio-function, 
           if return-code > 0
              move return-code to f
              display message F_ERRNO 
                      title   "S$IO Error: open" 
      *record writing
           move 0 to rec-val.
           display label line 6 title "Writing into file..."  
           set s-write-function to true
           perform 5 times
              add 1 to rec-val
              call "s$io" using sio-function, 
              if return-code = 0
                 display message F_ERRNO 
                         title   "S$IO Error: write" 
      *close file  
           display label line 8 title "Closing file..."
           set s-close-function to true.
           call "s$io" using sio-function, 
           if return-code > 0
              move return-code to f
              display message F_ERRNO 
                      title   "S$IO Error: close" 

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left