Openi
Use Openi
to open and close a sequential file in read-only mode on one of the available servers from a Sage X3 application server.
OpeniOpeni Using [ABBREVIATION]Openi FILE_EXPROpeni FILE_EXPR Using [ABBREVIATION]Openi FILE_EXPR, SEEK_EXPROpeni FILE_EXPR, SEEK_EXPR Using [ABBREVIATION]
* `FILE_EXPR` is an expression that returns a string containing the path of the file to open.* `SEEK_EXPR` is an integer expression that returns the offset in the file (in bytes) from which the read starts. If omitted or if 0, the read starts from the beginning.* `ABBREVIATION` is an abbreviation that identifies the channel opened to read the file. # Let's open a file on the server, skipping the first 10 charactersOpeni "C:\Temp\my_file.txt",10...# Close the last file opened to readOpeni# Opening a file on the "distrib" serverOpeni "distrib@"+[L]NOMFIC# Open two files located in the TMP sub-directory of the folder directory on the application serverOpeni filpath('TMP','rdfile1','') Using [YYY]Openi filpath('TMP','rdfile2','') Using [ZZZ]# Close the two previously opened filesOpeni Using [YYY]Openi Using [ZZZ]
Use Openi
to open a file for reading data with Rdseq and Getseq.
The first parameter is the file path that must be opened:
"server@local_path"
, where server
is the server name and local_path
the path of the file on this server.Openi
, used without a file name, closes the previously opened file.The value given in the 2nd parameter is used to position the read position (in bytes) in the file:
When a unique file is opened, there is no need to give an abbreviation. If several files are opened, it is preferable to use an abbreviation that can be freely chosen and used later to identify the channel used.
* The maximum number of sequential files that can be opened simultaneously is given by the value of the adxmso system variable.
* For a given abbreviation (or without abbreviation), only one sequential file can be opened by Openi
or Openio at a given moment. Opening a file in write mode closes any file that may have been previously opened with Openi
or Openio with this abbreviation (or with no abbreviation).
The current read position can be known:
* By adxseek(0) if the file has been opened without abbreviation.
* By adxseek("ABREV")
if the [ABREV]
abbreviation is used.
For obvious security reasons, the execution of this instruction is controlled on Clouds environments:
trusted
execution conditions, only the locations allowed by the sandbox white list are allowed.untrusted
execution conditions, only the locations defined as secured
are allowed.If the conditions defined by the sandbox are not fulfilled, an error 27 will be raised.
For more information, look at the sandbox configuration page.
Error code | Description |
---|---|
10 | FILE_EXPR is not a Char type or SEEK_EXPR is not numeric. |
20 | Nonexistent file or path folder. |
25 | System error when connecting to a remote server. |
27 | Access not possible, permission denied. |
50 | exp_depl < 0. |
57 | No seek operation allowed on the file. |
60 | Too many channels used. |
Openo, Openio, Seek, Getseq, Rdseq, Putseq, Wrseq, adxifs, adxirs, adxium, adxmso, adxseek.