How would I create my own CBL_CHECK_FILE_EXIST routine?

Question ID : 169
Created on 2011-05-16 at 11:31 AM
Author : Veryant Support [support@veryant.com]

Online URL : http://support.veryant.com/support/phpkb/question.php?ID=169



Here is an example:


       id division.
       program-id. CBL_CHECK_FILE_EXIST.
      
       data division.
       working-storage section.
       77 ret-code pic 9.
       01 fileInfo.
         03 fileSize    PIC X(8) COMP-X.
         03 fileDate    PIC 9(8) COMP-X.
         03 fileTime    PIC 9(8) COMP-X.
       77 file-date-string pic 9(8).
       77 file-time-string pic 9(8).
      
       linkage section.
       01 filename                  pic x any length.
       01 file-details.
         03 cblte-fe-filesize       pic x(8) comp-x.
           03 cblte-fe-filedate.
             05 cblte-fe-day        pic x comp-x.
             05 cblte-fe-month      pic x comp-x.
             05 cblte-fe-year       pic x(2) comp-x.
           03 cblte-fe-filetime.
             05 cblte-fe-hours      pic x comp-x.
             05 cblte-fe-minutes    pic x comp-x.
             05 cblte-fe-seconds    pic x comp-x.
             05 cblte-fe-hundredths pic x comp-x.
      
       procedure division using filename file-details.
          call "c$fileinfo" using filename, fileinfo, returning ret-code.
          if ret-code is not = 0 then
            initialize file-details
            goback 13
          end-if
          move filesize to cblte-fe-filesize.
          move filedate to file-date-string.
          move filetime to file-time-string.
          move file-date-string(1:4) to cblte-fe-year.
          move file-date-string(5:2) to cblte-fe-month.
          move file-date-string(7:2) to cblte-fe-day.
          move file-time-string(1:2) to cblte-fe-hours.
          move file-time-string(3:2) to cblte-fe-minutes.
          move file-time-string(5:2) to cblte-fe-seconds.
          move file-time-string(7:2) to cblte-fe-hundredths.
          goback 0.



Back to Original Question