Previous Topic Next topic Print topic


Directory management statements

This section describes the statements that are useful when implementing directory-polling schemes.

Directory polling, as related to XML documents, allows two or more independent processes to pass XML documents between the processes. For example, one or more writer processes may place XML documents in a well-known directory (a well-known directory is a directory name that is known to all of the interested processes). Each XML document must have been given a unique name. A reader process finds, processes, and removes XML documents from the same well-known directory.

Directory polling may be used to communicate with message-driven communications systems. It is a technique that may also be used between various COBOL applications. Multiple COBOL runtime systems (perhaps running on separate machines on the same local area network) can use directory polling (perhaps to a directory that is available on the network) as a means of improving throughput in processing XML documents.

It is not feasible to use multiple reader processes on the same directory because the XML FIND FILE statement, invoked from separate processes, could find the same file. For the Windows implementation, a sample C language program (DirSplit) is provided that will poll a single directory and distribute files to subdirectories as they arrive. This will allow separate COBOL programs each to process a separate subdirectory.

Note: The following problems have been encountered on Windows systems running the older FAT32 file system:
  • When a program is adding XML document files to a directory concurrently with another program that is moving XML document files to different directory using the C library function rename or the Windows API function MoveFile, it is possible for the wrong file to be moved or for the file to be moved to the wrong location. This failure can occur without the participation of XML Extensions.
  • When a large number of XML document files are written to a directory by XML Extensions using XML EXPORT FILE (on page 30), it is possible that files will not be placed in the directory and no error will be returned by the operating system either to XML Extensions or to the program issuing the statement. It appears that the FAT32 file system may be limited to 65,535 files per directory (at least under certain conditions). Furthermore, if long filenames are used, multiple directory entries may be needed for each filename, further reducing the number of files per directory.
For these reasons, it is recommended that directory polling not be used on Windows running with FAT32 file systems. Windows with the NTFS file system and UNIX file systems do not demonstrate this problem.
Previous Topic Next topic Print topic