TextIo.read Method

Reads the next full record from a TextIO object.


public container read()

Called

A container that holds one record.

Each entry in the container equals one field in the record. The definition of the next full record is controlled by the inFieldDelimiter, inRecordDelimiter, and inRecordLength properties. These properties have default values that allow input and output of the most common formats. It might be necessary to adjust the properties by using the inFieldDelimiter, inRecordDelimiter, and inRecordLength methods.

The following example reads a record from a file and uses the conpeek function to extract values from the record.

public void run()
{
    container         fileRecord;
    IntrastatToProdCom intrastatToProdCom;
    ;

    if (filename)
    {
        this.initializeFile();
        fileRecord = prodComFile.read();
        ttsbegin;
        while (fileRecord)
        {
            intrastatToProdCom.IntrastatItemCodeID = conpeek(fileRecord, 1);
            intrastatToProdCom.InventProdComCodeID = conpeek (fileRecord, 2);
            intrastatToProdCom.ValidFromYear = conpeek (fileRecord, 3);
            intrastatToProdCom.ValidTillYear = conpeek (fileRecord, 4);
            intrastatToProdCom.insert();
            filerecord = prodComFile.read();
        }
        ttscommit;
    }
}

Community Additions

ADD
Show: