Toshiba KB-80 Computer Keyboard User Manual


 
- 28 -
FIELD
Function Allocates the variable area to the random file buffer. (Record definition)
Format FIELD [#] <file number>, <field width> AS <character variable> [, <field width> AS
<character variable> ] ···
Term <file number>: The number assigned to the file by the OPEN statement
<field width>: The number of characters to be assigned to character variables
<character variable>: The variable name to be used for the input/output of the
random file
Explanation The FIELD statement specifies the contents of the random file buffer to which
read/write is performed by the PUT statement and the GET statement. Therefore, the
FIELD statement should be executed before the PUT statement and the GET
statement are executed.
Ex.)
FIELD #1,20 AS TEL$,30 AS NAM$
The above means the first 20 characters (20 bytes) from the furthest left in the
random file buffer #1 (No. 1) are assigned to the character variable, TEL$, and the
next 30 characters are assigned to NAM$. These are called “fields”.
File buffer TEL$ NAM$
20 bytes 30 bytes
The buffer in the random file can be efficiently allocated to more character variables
by the FIELD statement.
The FIELD statement does not actually transfer data to the random file buffer. Data
transmission to the buffer is performed by the LSET statement and RSET statement.
The total number of bytes to be allocated by the FIELD statement is not allowed to
exceed the record length specified in the OPEN statement. The number of bytes set
in the FIELD statement is the record length.
The FIELD statement defines the buffer from the first character for every execution.
Therefore, one or more areas can be defined for the same data.