Jaa


TextIo.inRecordLength Method

Definition

Overloads

inRecordLength(Int32)
inRecordLength()

Gets or sets the record length for an input file.

inRecordLength(Int32)

public:
 override int inRecordLength(int _value);
public override int inRecordLength (int _value);
override this.inRecordLength : int -> int
Public Overrides Function inRecordLength (_value As Integer) As Integer

Parameters

_value
Int32

The record length for the input file; optional.

Returns

Applies to

inRecordLength()

Gets or sets the record length for an input file.

public:
 override int inRecordLength();
public override int inRecordLength ();
override this.inRecordLength : unit -> int
Public Overrides Function inRecordLength () As Integer

Returns

The record length for the input file.

Remarks

For files that have a fixed-length format, use the inRecordLength property to ensure that no more than the specified number of characters are read for each record. If the record format is overruled by a specified inRecordDelimiter property value, that is the inRecordDelimiter value is met before the fixed length is read, the record is accepted, and no further data is read. To ensure that a fixed number of characters are read, set the inRecordDelimiter property value to an empty string. When no inRecordDelimiter property value is found, the inRecordDelimiter property value is the maximum limit of characters to read. Set the inRecordDelimiter property value to zero to disable the record length check.

The following example sets the record length to 128.

boolean openFile() 
{ 
    boolean ret = false; 
    int     recordLength = 128; 
    int     numOflastCharacter = 255; 
    textFile = new TextIo(filename, 'r'); 
    if (textFile) 
    { 
        if (textFile.status()) 
        { 
            throw error("@SYS52680"); 
        } 
        textFile.inFieldDelimiter(num2char(numOflastCharacter)); 
        textFile.inRecordDelimiter(num2char(numOflastCharacter)); 
        textFile.inRecordLength(recordLength); 
        ret = true; 
    } 
    return ret; 
}

Applies to