CALL "S$IO" USING opCode                     parameters             GIVING returnCode  | 
opCode  | Specifies the file handling function to be performed. Valid values, defined in isfilesys.def are:  | |
Opens an existing file  | ||
Closes an opened file  | ||
Creates an empty file  | ||
Reads a record from a file  | ||
Writes data into file  | ||
Rewrites data into file  | ||
parameters  | Parameters depend on the opcode.  | |
       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,                               file-io,                               sio-lparms            if return-code = 0               display message F_ERRNO                        icon    mb-error-icon                       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,                               file-io,                               open-mode,                               max-rec-sz,                               seq-type,                               0,                               0    | 
           if return-code > 0               move return-code to f            else               display message F_ERRNO                        icon    mb-error-icon                       title   "S$IO Error: open"             end-if       *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,                                  f,                                  rec-buffer,                                  0,                                  0               if return-code = 0                  display message F_ERRNO                           icon    mb-error-icon                          title   "S$IO Error: write"                end-if            end-perform       *close file              display label line 8 title "Closing file..."            set s-close-function to true.            call "s$io" using sio-function,                               f.            if return-code > 0               move return-code to f            else               display message F_ERRNO                        icon    mb-error-icon                       title   "S$IO Error: close"             end-if ...  |