WRSEQ

Contents


Wrseq is used to write data on a text file opened by Openo or Openio.

Syntax

   Wrseq expr_list [ sep ] [ Using class ]

Parameters

Element

Description

Restrictions

expr_list

List of indifferent expressions to write, separated by ',' or ';'.

None.

sep

Separator that can be ',' or ';'.

None.

class

Abbreviation describing the open file.

None

Examples

   # Addition of a line to the passwd file in the connection directory
   # (it presents the file structure /etc/passwd)
    Char NAME(20), PASSWORD(20)
    Integer USR_NO, GROUP_NO
    Char COMMENT(50), LOGIN_DIR(50), SHELL_USED(50)
    NAME = "toto"
    USR_NO = 0
    GROUP_NO = 0
    COMMENT = "test"
    LOGIN_DIR = ""
    SHELL_USED = ""
    PASSWORD = ""
    Openo getenv$("HOME")+"/passwd", -1
    adxifs = ':' : adxirs = chr$(10)
   
Wrseq NAME, PASSWORD, USR_NO, GROUP_NO,
   
Wrseq COMMENT, LOGIN_DIR, SHELL_USED
    Openo

   # Write on 3 sequential files
    Char MOT1(30)
    Char MOT2(30)
    Char MOT3(30)
    adxifs = ':' : adxirs = chr$(10)
   
Openo filpath('TRT','ZINSTRUC1','txt') Using [FIC1]
    Openo filpath('TRT','ZINSTRUC2','txt') Using [FIC2]
    Openo filpath('TRT','ZINSTRUC3','txt') Using [FIC3]
    MOT1 = "abcde"
    MOT2 = "fghij"
    MOT3 = "klmno"
    Wrseq MOT1 Using [FIC1]
    Wrseq MOT2 Using [FIC2]
    Wrseq MOT3 Using [FIC3]
    Openo Using [FIC1]
    Openo Using [FIC2]
    Openo Using [FIC3]

Description and comments

Wrseq is used to write in a text file recordings separated by a recording separator containing an indifferent number of fields, themselves being separated by a field separator.

Wrseq is used jointly with the adxirs Adonix system variable to define the recording separator, the adxifs Adonix system variable to define the field separator and the adxium Adonix system variable to define the coding of the character string:

These three variables can be impacted for each file for the Iomode instruction.

Warning ! Wrseqcannot write a file coded in UCS2.

If the Wrseq order does not end with ',' or ';', the recording separator (adxirs value) is written on the file.

The numerical or date-type variables are automatically converted to character strings in the file, as if the num$ Adonix function had been used..

Each written field can contain a maximum of 255 characters.

The Using clause is used to specify the class of the sequential file that is being written. It is now possible to process several sequential files at the same time.

It is possible to write an image file (or Clob) to a sequential file to the format defined by adxium using the Wrseq instruction. The file will then have the number of characters of the image file (or Clob).

Remarks

The adxseek(1) or adxseek(class) function (for a file open with a class) indicates the current position in the file (in number of bytes) with respect to the beginning of the file. This variable is equal to -1 if no file has been openend in writing mode by Openo or Openio.

Since the writes in a file are buffered, they are only effective after said file has been closed by the Openo or Openio instructions. It means that, before the operation, the size of the file on the disk can be unchanged after Wrseq.

"Seek 0" makes it possible to force the write of a file that has been opened by Openio.

Associated errors

Error

Description

ERDIM (55)

Variable with more than one dimension

ERULIM (65)

ulimit problem (the file is too big).

ERGFIC (24)

File not open .

ERMDISK (44)

No space available any longer on the disk.

Associated keywords

OPENO - OPENIO - ADXSEEK - SEEK - ADXIFS - ADXIRS - ADXIUM - IOMODE


CONTENTS

Copyright © Sage 1999 - 2007