Share via


TextIo.read Method

Reads the next full record from a TextIO object.

Syntax

public container read()

Run On

Called

Return Value

Type: container
A container that holds one record.

Remarks

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.

Examples

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; 
    } 
}

See Also

TextIo Class

TextIo.inFieldDelimiter Method

TextIo.inRecordDelimiter Method

TextIo.inRecordLength Method