File and Filename Routines

CBL_CHANGE_DIR Change current directory
CBL_CHECK_FILE_EXIST Check if file exists
CBL_COPY_FILE Copy file
CBL_CREATE_DIR Create directory
CBL_DELETE_DIR Delete directory
CBL_DELETE_FILE Delete file
CBL_DIR_SCAN_END End the scan of a directory
CBL_DIR_SCAN_READ Read next item from a directory
CBL_DIR_SCAN_START Start scan of a directory
CBL_GET_CURRENT_DIR Return the current directory
CBL_FILENAME_CONVERT Convert a filename between space-terminated and null-terminated format
CBL_FILENAME_MAX_LENGTH Return the maximum size of the filename that can be handled by the operating system
CBL_JOIN_FILENAME Join parts of filename
CBL_RENAME_FILE Rename file
CBL_SPLIT_FILENAME Divide filename into parts
MFFH_MODIFY_DISABLE Disable modifications to FCD trace fields
MFFH_MODIFY_TRACE Modify FCD trace fields
PC_FIND_DRIVES Find valid drives
PC_READ_DRIVE Read current drive
PC_SET_DRIVE Set current drive
X"91" function 46 Enable null insertion
X"91" function 47 Disable null insertion
X"91" function 48 Enable tab insertion
X"91" function 49 Disable tab insertion
X"91" function 69 Scan directory

The CBL_JOIN_FILENAME and CBL_SPLIT_FILENAME routines enable you to parse a filename into its component strings and to join strings together to form a filename. They can be used together to replace components of a filename, such as the extension. They can handle both null-terminated and space-terminated filenames.

A filename is split up into path, basename and extension. For example, in the filename d:\dir1\dir2\file.dat the path is "d:\dir1\dir2", the basename is "file", and the extension is "dat".

These two routines can work with filenames up to 65,535 characters long, but your environment or run-time system imposes a limit of 256 characters on the maximum length of basename.ext, and 261 characters on the maximum length of the entire filename.

Filename Routines - Example

Interpreting the return code as a file status code

Related Topics: