Previous Topic Next topic Print topic


CBL_DIR_SCAN_READ

Searches for the next entry in the file system using a search handle returned by a previous CBL_DIR_SCAN_START.

Syntax:

CALL "CBL_DIR_SCAN_READ" using  by reference   handle
                                               entry
                                   returning   search-status

Parameters:

handle
usage pointer.
entry
Group item containing the following subordinate items:
01 entry         
   03 attribute        cblt-x4-comp5. *> pic x(4) comp-5
   03 date-stamp  
      05 year          cblt-x4-comp5. *> pic x(4) comp-5
      05 month         cblt-x2-comp5. *> pic x(2) comp-5
      05 day           cblt-x2-comp5. *> pic x(2) comp-5
      05 hour          cblt-x2-comp5. *> pic x(2) comp-5
      05 minute        cblt-x2-comp5. *> pic x(2) comp-5
      05 second        cblt-x2-comp5. *> pic x(2) comp-5
      05 millisec      cblt-x2-comp5. *> pic x(2) comp-5
      05 dst           cblt-x1-comp5. *> pic x comp-5
      05 size          cblt-x8-comp5. *> pic x(8) comp-5
      05 name     
         07 max-len    cblt-x2-comp5. *> pic x(2) comp-5
         07 entry-name pic x(max-len)
status-code
See Library Routines - Key.

On Entry:

handle
Set by CBL_DIR_SCAN_START. This field identifies the search operation. Search parameters cannot be changed for a given handle.
max-len
The length of the entry-name field.

On Exit:

attribute
Describes the properties of the entry found. Valid values are:
Value Bit Set Meaning
1 0 File found
2 1 Directory found
4 2 The entry found is not a file or a directory
8 3 The entry is readable
16 4 The entry is writable
32 5 The entry is hidden
If the entry found is a file, any of bits 3, 4 and 5 may be set, to indicate whether or not the file is readable and so on. These bits may be set if the entry found is not a file, but the meaning in this case is undefined.
Note that this is a return field. The flags in bits 0 to 2 reflect the entry's properties and may not be the same as the search attributes.
date-stamp
This group field holds the date and time that the entry was last written.
Attribute Description
year Current year minus 1900
month Month, 0-11; January = 0
day Day of month, 1-31
hour Hour of day, 0-23
minute Minute
second Seconds
millisec Milliseconds. On some systems millisec is set to zero
dst Daylight saving time flag: 0 means that daylight saving was not in operation; 1 means that daylight saving was in operation when the entry was last written; 255 means that the daylight savings setting is unknown.
size
The size of the file in bytes.
entry-name
The name of the entry found. For native Windows projects this is the filename only, for JVM and UNIX projects it is the filename with relative path.
search-status
Return status:
0 Success
1 Unable to start search
2 Invalid search handle
3 Search finished
127 Other error

Comments:

Errors associated with an entry-name field that is too small for the result will be ignored. If you do not supply a large enough field, the result will be truncated to fit. If you supply a field that is shorter than max-len you will corrupt memory.

Previous Topic Next topic Print topic