F-READ
Reads an item from a file into a file buffer.
Syntax
F-READ fileBufferNumber itemId
altCmd
F-R fileBufferNumber itemId
altCmd
Syntax Elements
fileBufferNumber
The number of the file buffer to which the file was assigned that contains
the item you want to read. Valid numbers are 1 to 47, but note that 19 and 20
are reserved for system Procs.
fileBufferNumber can be a direct or indirect file buffer reference.
itemId The name of the item to be read. itemId can be a literal string (not enclosed in quotes), or it can be a direct or indirect reference to a buffer or select register containing the item-id that you want to read.
altCmd The command(s) to be executed if the named item cannot be read. Must be on the line immediately after the command itself.
Operation
The F-READ command is always followed by a command line that is executed if the read fails.
If the file to be read has not been opened previously with an F-OPEN command, execution of the Proc terminates with an error message.
If the specified item is not on file, the statement on the line immediately following the F-READ command is executed.
If the read is successful, the statement on the line immediately following the F-READ command is skipped and execution continues 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-READ 1 123-AB
003 XItem 123-AB cannot be found
004 OItem 123-AB found
Reads the item 123-AB into file buffer 1. If item 123-AB cannot be found, the statement on line 3 is executed and the Proc is exited. Otherwise, the message on line 4 is displayed and execution of the Proc continues.
001 PQN 002 OEnter part number+ 003 10 IP %3 004 F-READ 7 %3 005 GOTO 25 006 T C,(10,10),"Quantity on hand = ",&7.2 . . . 015 25 "Part no. ",%3," not found...Try again",+ 016 GOTO 10
Reads the part number (represented by %3) entered at the terminal into file buffer 7. If the part number is invalid, control transfers to label 25 on line 015, and you are given another chance to enter a valid part number. Otherwise, execution continues on line 006.