OPENI

Contents


Openi is used to open and close a sequential file in read-only.

 

Syntax

   Openi [ exp_nomfic [, exp_depl ] ]  [ Using abrev ]

 

Parameters

Element

Description

Restrictions

exp_nomfic

Char type expresson whose result is a filepath (Unix or MS-DOS)

None.

exp_depl

Numerical expression for the initial move value (seek).

0 <= exp_depl <= size of file.

abrev

Abbreviation indicating an open file.

None.

 

Examples

   # Opening a file, skipping the first 10 characters
    Openi filpath('tmp','rdfile',''), 10

   # Closing the last file opened to read
    Openi

   # To read on the standard input medium (keyboard)
    Openi "*"

   # Opening a file on the "distrib" machine
    Openi "distrib@"+[L]NOMFIC

   # Opening file X3.ini on the client
    Openi "#@C:\X3\X3.ini"

   # Opening two files
    Openi filpath('tmp','rdfile1','') Using [YYY]
   
Openi filpath('tmp','rdfile2','') Using [ZZZ]

   # Closing the two previously opened files
    Openi Using [YYY]
   
Openi Using [ZZZ]

 

Description and comments

Openi is used to open a file for reading with Rdseq and Getseq.

The client station is conventionally indicated by the server #.

The value given in the 2nd parameter is used to start reading at a given position in the file. If it is missing, or null, the read will start at the beginning of the file. In all cases, the Seek command is used to move around during the read. The adxseek(0) or  adxseek(abrev) functions give the position in the file.

The Using clause allocates an abbreviation to an open sequential file. Consequently, up to 7 sequential files may be opened simultaneously, subject to the value of the parameter adxmso.

File without abbreviation:

·         The adxseek(0) function gives the position in the file.

·         There may be only one sequential file without abbreviation opened by Openi or Openio at a given moment. Opening a file in read mode closes any file that may have been opened previously with Openi or Openio.

·         Openi used without a parameter closes the previously opened file or stops allocation from the input keyboard.

File with abbreviation:

·         The adxseek(abrev) function gives the position in the file.

·         There may not be more than one file opened with the same abbreviation at a given moment. Opening a file with one abbreviation (including in a sub-programme) will close the file previously opened.

·         Openi, used with the using abrev clause only closes the file previously opened without this abbreviation.

If the file does not exist, an error (PAFIC) will be initiated.

If Openi is used with filename "*", the standard Adonix input device (in principle the keyboard) is assigned to an open file, allowing the characters to be read from the keyboard without decoding.

 

Associated errors

Error

Description

ERMODE (10)

exp_nomfic is not a Char type or exp_depl is not numerical.

ERDOM (50)

exp_depl < 0.

ERACCE (27)

Access impossible (permission refused).

PAFIC (20)

File (or path directory) non-existent.

ERSEEK (57)

The file is the standard input (exp_nomfic='*') and exp_depl <> 0.

ERCHAN (60)

Not enough channels to open (where one is required).

ERSYST (25)

System error (problem connecting to remote machine).

 

Associated key words

OPENO - OPENIO - SEEK - GETSEQ - PUTSEQ - RDSEQ - WRSEQ - ADXIFS - ADXIRS - ADXSEEK - ADXMAC - ADXMSO


CONTENTS


Copyright © Sage 1999 - 2007