Opening and Closing Files
The OPEN command in PRO/5 is used to associate a PRO/5 channel with a file or device.
Opening Files
The OPEN command in PRO/5 is used to associate a PRO/5 channel with a file or device. After opening a file PRO/5 positions the file pointer to the first record or byte in the file.
Syntax
OPEN (chan)"file"
Parameter |
Description |
chan |
A channel that is not currently in use. (The UNT variable returns an unused channel.) |
"file" |
Name and path of the file to be opened. |
Opening any PRO/5 file with the ISZ= option causes it to be opened as a STRING file. (For PROGRAM files, use ISZ=-1.) This causes PRO/5 to treat the file as though it could not find a PRO/5 header of the file (a STRING file). This allows you to directly modify structure of the file. The file itself is locked for the duration of the ISZ= open and may not be OPENed on more than one channel.
Closing Files
A channel may be closed by using the CLOSE command. In addition, the BEGIN, START, END, and STOP verbs will close all OPENed channels except channel 0.
Note:
In PRO/5 15.01 and higher, and BBj 15.10 and higher, the OPEN verb by default is restricted from opening pipes (commands starting with "<", ">", or "|") in console mode. This is to protect against accidentally overwriting a data file as a side effect of inadvertently specifying a pipe expression. To open a pipe at the console, set SETOPTS byte 9 bit $10$ or include MODE="PIPE" in the OPEN.