•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileFIELD #n,num AS svar$ [,num AS svar$,num AS svar$,...]
FIELD #n,num AT(x) [,num AT(x),num AT(x),...]

n, num, x: iexp
svar$: svar (not an array variable)

The command FIELD # AS is used to divide data records into fields. The
numerical expression n is the number of the data channel (0 to 99) of a file
previously opened with OPEN. The integer expression num determines the field
length. The variable svar$ contains data for one field of a data record.  If
the data record is to be divided into several fields, the parts 'num AS svar$'
must be separated by commas. The sum of the individual field lengths must equal
the data reeord length, otherwise an appropriate error message is displayed.
Thus in order to keep the field lengths to those specified in the FIELD command
it is convenient to use the commands LSET and RSET or MID$.

By using AT() instead of AS numeric variables can be written to a random access
file. In this case num must contain the length of the variable (1 for
byte-type, 2 for word-type etc.) and the brackets must contain a pointer to the
variable (see *, VARPTR()). Actually an arbitrary area of memory can be
transferred by specifying the number of bytes (num) and the address of the
first byte (x). Note that there is no space after the 'AT'.

For example:

    FIELD #1,4 AT(*a%),2 AT(*b&),8 AT(*c#)

Arbitrary combinations of AS and AT() are possible, e.g.:

    FIELD #2,4 AS a$,2 AT(*b&),8 AT(*c#),6 AS d$

Unlike in Version 2, several successive FIELD commands can be used, on
sucessive lines, referring to the same channel number. The effect is the same
as that of one long FIELD command. The maximum record length is 32767 bytes,
and the maximum number of fields approximately 5000.

Memo: Version 1 had a limit of 9 fields.
      Version 2 had a limit of 19 fields.
      Version 3 has no such limit.
      Thus error code #53 was retired.

      Versions 1 & 2 had a limit of one FIELD command per OPEN command.
      Thus error code #51 was retired.