skip to main content

Library Routines : C$LIST_DIRECTORY

C$LIST_DIRECTORY
The C$LIST_DIRECTORY library routine provides a number of functions to retrieve the content of a directory.
Syntax:
 CALL "C$LIST_DIRECTORY" USING opCode 
Parameters:
Return code:
returnCode definition and meaning depend on the opcode.
Examples:
Example - The following program displays on the system output the list of all files and directories in C:\
       PROGRAM-ID. dir.
       WORKING-STORAGE SECTION.
       copy "iscobol.def".
       01  fileEntry.
           05 fileType             pic x(6).
           05 fileName             pic x(74).
       77  listdirHandle           usage handle.
       PROCEDURE DIVISION.
           CALL "C$LIST-DIRECTORY" using  LISTDIR-OPEN, "C:\""*"
           if listdirHandle not = 0
              perform until exit
                 CALL "C$LIST-DIRECTORY" using LISTDIR-NEXT
                 if fileName = spaces
                 if listdir-file-type = "D"
                    move "<DIR>" to fileType
                 display fileEntry upon sysout
              CALL "C$LIST-DIRECTORY" using LISTDIR-CLOSE, listdirHandle

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left