Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

CBL_DIR_SCAN_READ

$
0
0

Hi

   I have a method that scans a directory and copies each file found to a sub-directory ("backup"). The problem is that the directory scan routine ("CBL_DIR_SCAN_READ") does not return with a file name. I get all of the time stamp info for a valid file, but no name. Could you tell me what I am doing wrong. Here is my method:


       Working-Storage Section.
      
       01 ScanHandle         Pointer.
       01 ScanPattern.
           05 Patternlength  Pic XX comp-5       Value 3.
           05 PatternText    Pic XXX             Value "*.*".
       01 ScanAttrib         Pic X(4) Comp-5     Value 1.     
       01 ScanFlags          Pic X(4) Comp-5     Value 2.
       01 changeStatus       Pic XX Comp-5.
       01 ScanStatus         Pic XX Comp-5.
       01 CopyStatus         Pic XX Comp-5.
       01 ScanEntry.
           05 EntryAttrib    Pic X(4) Comp-5.
           05 EntryDateStamp.
               10 Year       Pic X(4) Comp-5.
               10 Month      Pic XX   Comp-5.
               10 DOW        Pic XX   Comp-5.
               10 Hour       Pic XX   Comp-5.
               10 Minute     Pic XX   Comp-5.
               10 Seconds    Pic XX   Comp-5.
               10 Mill       Pic XX   Comp-5.
               10 DST        Pic X    Comp-5.
               10 FileSize   Pic X(8) Comp-5.
               10 FileName.
                  15 NameLn Pic XX    Comp-5.
                  15 NameTx.
                       20 NT Pic X Occurs 1 to 256 Times Depending on NameLn.
       01 FileName1          Pic X(256).
       01 fileName2          Pic X(256).
       01 filePath           Pic X(256).                     
                   
       procedure division using by value sender as object e as type System.EventArgs.
      
           Set FilePath to LB_Path.
           Call "CBL_CHANGE_DIR" Using FilePath Returning ChangeStatus.
           If ChangeStatus Not = Zeroes Exit Method.
           Call "CBL_DIR_SCAN_START" using by Reference Scanhandle,
                                           By reference ScanPattern,
                                           by Value ScanAttrib,
                                           By Value ScanFlags,
                                           Returning ScanStatus.
           If Scanstatus Not = Zeroes Exit Method.                                          
       Loop.
           Call "CBL_DIR_SCAN-READ" using By Reference ScanHandle,
                                          By Reference ScanEntry,
                                          Returning ScanStatus.
           If ScanStatus = 0
               Set FileName1 to LB_Path & "/" & NameTx
               Set fileName2 to LB_Path & "/backup/" & Nametx
               Call "CBL_COPY_FILE" using FileName1, FileName2, Returning CopyStatus
               If CopyStatus Not = Zeroes
                   Invoke type MessageBox::Show("Copy Error: Code=" & CopyStatus, "Copy Error",
                                                type MessageBoxButtons::OK,
                                                type MessageBoxIcon::Error)
      *            Exit method
               End-If
           End-If.
           If ScanStatus = 0 go to Loop.                                                    
      


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>