Instruccion FIELD

Objetivo:

Asignar espacio para variables en un parachoques de archivo arbitrario.

Sintaxis:

 FIELD [#] filenum, width AS stringvar [,width AS stringvar].

Comentarios:

filenum es el n�mero bajo el cual el archivo fue abierto.

width es el n�mero de caracteres para ser asignados a la variable de cuerda.

string variable es una variable de cuerda que ser� usada para el acceso de archivo arbitrario.

Una declaraci�n FIELD debe haber sido ejecutada antes de que usted pueda

  • Consiga datos de un parachoques arbitrario despu�s de una declaraci�n GET
  • Entre en datos antes de una declaraci�n PUT

Por ejemplo, la l�nea siguiente asigna las 20 primeras posiciones (bytes) en el parachoques de archivo arbitrario a la variable de cuerda N$, las 10 siguientes posiciones a ID$, y las 40 siguientes posiciones a ADD$:

 FIELD 1, 20 AS N$, 10 AS ID$, 40 AS ADD$

FIELD s�lo asigna el espacio; esto no coloca ningunos datos en el parachoques de archivo arbitrario.

El n�mero total de bytes asignados en una declaraci�n FIELD no debe exceder la longitud de registro especificada cuando el archivo fue abierto. Por otra parte, "Field overflow" error ocurre (la longitud de registro de falta es 128).

Cualquier n�mero de declaraciones FIELD puede ser ejecutado para el mismo archivo, y todas las declaraciones FIELD ejecutadas son en efecto al mismo tiempo.


Note

No use un nombre variable presentado en INPUT O LET a la declaraci�n. Una vez que un nombre variable es presentado, esto se�ala al lugar correcto en el parachoques de archivo arbitrario. Si INPUT subsecuente o LET a la declaraci�n con aquel nombre variable es ejecutado, la aguja de la variable es movida para ensartar el espacio (ver LSET/RSET GET declaraciones).


 

FIELD Statement

Purpose:

To allocate space for variables in a random file buffer.

Syntax:

FIELD [#] filenum, width AS stringvar [,width AS stringvar]...

Comments:

filenum is the number under which the file was opened.

width is the number of characters to be allocated to the string variable.

string variable is a string variable which will be used for random file access.

A FIELD statement must have been executed before you can

  • Get data out of a random buffer after a GET statement
  • Enter data before a PUT statement

For example, the following line allocates the first 20 positions (bytes) in the random file buffer to the string variable N$, the next 10 positions to ID$, and the next 40 positions to ADD$:

FIELD 1, 20 AS N$, 10 AS ID$, 40 AS ADD$ 

FIELD only allocates space; it does not place any data in the random file buffer.

The total number of bytes allocated in a FIELD statement must not exceed the record length specified when the file was opened. Otherwise, a "Field overflow" error occurs (the default record length is 128).

Any number of FIELD statements may be executed for the same file, and all FIELD statements executed are in effect at the same time.


Note

Do not use a fielded variable name in an INPUT or LET statement. Once a variable name is fielded, it points to the correct place in the random file buffer. If a subsequent INPUT or LET statement with that variable name is executed, the variable's pointer is moved to string space (see LSET/RSET and GET statements).

1