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

RE: Confirm native vs managed CBL_DIR_SCAN_READ behavior?

$
0
0

My program does the same thing. I use "c:\temp\*" as my search string.

If I set the flags to 1 I get only the filenames.

If I set flags to 2 or 3 then the following will be returned:

native code:
.

..

managed code

c:\temp\.

c:\temp\..

The program I am using is:

       id division.
       program-id. plainscan.
       working-storage section.
       01 any-key pic x.
       01 f-entry.         
          03 f-attribute        pic x(4) comp-5.
          03 f-date-stamp.  
             05 f-year          pic x(4) comp-5.
             05 f-month         pic x(2) comp-5.
             05 f-day           pic x(2) comp-5.
             05 f-hour          pic x(2) comp-5.
             05 f-minute        pic x(2) comp-5.
             05 f-second        pic x(2) comp-5.
             05 f-millisec      pic x(2) comp-5.
             05 f-dst           pic x    comp-5.
             05 f-size          pic x(8) comp-5.
             05 f-name.     
                07 f-max-len    pic x(2) comp-5 value 256.
                07 f-entry-name pic x(256).
       
       01 scan-pattern.
           05 pattern-len       pic x(2) comp-5  value 0.
           05 pattern-text      pic x(256)       value spaces.
       01 scan-attrib           pic x(4) comp-5  value 1.      
       01 scan-flags            pic x(4) comp-5  value 2.
       01 scan-status           pic x(2) comp-5  value 0.
       01 scan-handle           pointer.
       procedure division.
           
           move z"c:\temp\*" to pattern-text
           move 0 to pattern-len
           move 3 to scan-attrib
           move 2 to scan-flags
           
           call "CBL_DIR_SCAN_START" 
              using by reference scan-handle,
                    by reference scan-pattern,
                    by value scan-attrib,
                    by value scan-flags,
              returning scan-status
           end-call
           
           perform until exit           
              move spaces to f-entry-name
              call "CBL_DIR_SCAN_READ"
                 using  by reference scan-handle
                                     f-entry
                 returning scan-status
              end-call
              if scan-status = 0
                 display f-entry-name(1:30) 
              else
                 call "CBL_DIR_SCAN_END" using scan-handle
                 exit perform
              end-if
           end-perform.
           accept any-key
           goback.

Viewing all articles
Browse latest Browse all 4356


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