Proc Reference > PQN Proc Commands > F-OPEN

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

F-OPEN command (Proc) (m618403+fopen.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

F-OPEN

Clears the file buffer and opens a file to allow reads and writes.

Syntax

F-OPEN file-buffer-number file-specifier
alt-cmd

F-O file-buffer-number file-specifier
alt-cmd

Syntax Elements

file-buffer-number
The number of the file buffer to which the file is assigned. Valid numbers are 1 to 47, but note that 19 and 20 are reserved for system Procs.

file-specifier The name of the file to be opened, as defined in Conventions.

file-specifier can be a literal (not enclosed in quotes) or can be a direct or indirect reference to a buffer or select register that contains it.

alt-cmd The command(s) to be executed if the named file cannot be opened. Must be on the line immediately after the command itself.

Operation

The F-OPEN command must always followed by a command to be executed if the OPEN fails.

After a file has been opened, it remains open for the rest of the execution of the Proc, including Proc to Proc transfers.

File buffers can be reused by issuing another F-OPEN statement.

If you try to open a nonexistent file, the command(s) on the line immediately following the F-OPEN command is executed.

If the file is opened successfully, the command(s) on the line immediately following the F-OPEN is skipped, and execution begins with the next line.

Comments

If you are only processing one item from a file, the FB command is preferable to an F-OPEN, F-READ command sequence.

Examples

001 PQN
002 F-OPEN 1 %1
003 XCannot open file
004 OFile opened successfully!
.

If the file represented by %1 cannot be opened, the message, "Cannot open file" is displayed and the Proc is exited. Otherwise, execution continues with the message "File opened successfully!"

001 PQN
002 F-OPEN 2 CARS
003 G 30
004 T C,(10,10),"Enter item-id of car you want",S5,+
.

If the CARS file cannot be opened, then control is transferred to label 30. Otherwise, execution continues with the display on line 004.

RealityV15.0Comment on this topic