ADXSEEK

Contents


adxseek is used to indicate the position of read and write pointers on sequential files.

 

Syntax

adxseek ( expr_n )

adxseek ( expr_c )

 

Parameters

Element

Description

Restrictions

expr_n

Whole number expression.

expr_n = 0 or  expr_n = 1

expr_c

Char type expression.

None.

 

Examples

   # Extraction of second field read from an input file, with copy
   # to an output file, displaying read / write pointers
         Openi "ENTREE"
    Openo "SORTIE"
    adxifs = ':' : adxirs = chr$(10) : I = 1
    Repeat
       Infbox "Read record:  "-I-"Position="-adxseek(0)
       Infbox "Write record: "-I-"Position=";adxseek(1)
       Rdseq CHAMP1, CHAMP2, CHAMP3
       Wrseq CHAMP2
    Until fstat <> 0

 

 

   # Same with files opened with a key word
         Openi "ENTREE" Using [ENT1]
    Openo "SORTIE" Using [SOR1]
    adxifs = ':' : adxirs = chr$(10) : I = 1
    Repeat
       Infbox "Read record:  "-I-"Position="-adxseek("ENT1")
       Infbox "Write record: "-I-"Position="-adxseek("SOR1")
       Rdseq CHAMP1, CHAMP2, CHAMP3
       Wrseq CHAMP2
    Until fstat <> 0

 

Description and comments

When opening a file in read-only with Openi or Openo, without a keyword, the read pointer, that is the shift (in number of octets) between the start of the file and the next data to be read, is returned by the function adxseek(0). If no file has been opened in read mode, adxseek(0) equals 0.

Similarly for a file opened in read-only by Openo or Openio without key word, adxseek(1) contains the write pointer, which is set to 0 if no file is open in write mode.

If Openio is used without keyword, the identical values are retained for adxseek(0) and adxseek(1).

For a file opened with a keyword, adxseek("abrev")contains the read or write pointer.

The variable adxseek(0) or adxseek("abrev") may be modified :
- by read (Rdseq, Getseq),
- by shift (Seek instruction).

The variable adxseek(1) ou adxseek("abrev") may be modified :
- by write (Wrseq, Putseq),
- by a shift (Seek instruction only if the file was opened by Openio).

These variables may not be assigned directly (read mode only).

 

Associated errors

Error

Description

 

 

 

Associated key words

OPENI - OPENO - OPENIO - SEEK - RDSEQ - WRSEQ - GETSEQ - PUTSEQ


CONTENTS


Copyright © Sage 1999 - 2007