Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

TextIo.read Method

Reads the next full record from a TextIO object.


public container read()

A container that holds one record. Each entry in the container equals one field in the record.

Called

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, however, 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;
    }
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.