File Handling

Processing Data Files

 

Different methods are available for transferring data to/from a PxPlus data file.

File access requires an OPEN statement to establish a connection before I/O operations can take place. This process involves setting a pointer to the beginning of the opened file, allocating system resources, and assigning a file number from 1 to 63 for local files, and 64 to 127 for global files. Extended file mode (see 'XF' system parameter) expands these ranges from 0 to 32767 for local files, and 32768 to 65000 for global files.

Once a file is opened, all further references to that file are handled via the assigned channel/file number. The actual number of files that can be opened at any one time depends on the operating system. Once a file number is assigned to a file, it cannot be reused until the file is closed, typically by the CLOSE directive.

Most applications will be accessing data and program files in more than one location (different directories, drives, etc.). While files can be referenced directly via their complete pathname, dealing with the different locations and path formats can sometimes be problematic. PxPlus has the ability to set default file search rules to simplify this process. See Prefix Processing.

PxPlus also has the ability to OPEN OS sequential (flat) files in order to handle transfer of data from non-PxPlus applications. See Foreign File Access.

See Also

Accessing Files
File Processing Directives
File Processing Functions
Processing Records
Accessing Directory Files
File Locking
Record Locking
Input and Output Parameters
Accessing ZIP Files