HP 3000 Manuals

POSITION [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

POSITION 

The POSITION statement positions the record pointer of a specified file
at a specified record.  The RESET option can reset the file to an empty
file.

Syntax 

                {rnum }
                {BEGIN}
POSITION #fnum; {END  }
                {RESET}

Parameters 

fnum             The file number that HP Business BASIC/XL uses to
                 identify the file.  It is a numeric expression that
                 evaluates to a positive short integer.

rnum             A numeric expression.  Positions record pointer at the
                 record specified by rnum.

BEGIN            Positions record pointer at first record in the file.

END              Positions record pointer at the EOF mark, beyond the
                 last record in the file.

RESET            Positions record pointer at first record in the file and
                 immediately writes an EOF marker.  All previous contents
                 of the file are lost following execution of the POSITION
                 statement with this option.

The POSITION statement is used to position the record pointer before a
sequential read or write to a file if the pointer is not already in the
desired position.  The POSITION statement is unnecessary before a direct
read or write, because a direct read or write statement specifies a
record.

Examples 

The following examples show the use of the POSITION statement.

     10 POSITION #1; 10      ! Record pointer is at record 10.
     20 POSITION #2; Nextrec ! Record pointer is at record indicated in Nextrec.
     30 POSITION #3; BEGIN   ! Record pointer is at the first record.
     40 POSITION #4; END     ! Record pointer is at the EOF mark.
     50 POSITION #5; RESET   ! Deletes the contents of the file. #5



MPE/iX 5.0 Documentation