FileGetNextRow Function

Action

Sets the row pointer to the row after the current row. If the current row is the last row in a file, then the current row is set to the first row of the file. After the current-row pointer is set with FileGetNextRow, you can access the columns of the row with the FileGetCol function. If the file is opened with a global FileLoad function (FileCSVLoadGlobal or FileFixedLoadGlobal), the current row pointer is set for all virtual users that access this file. Otherwise, the current row pointer is set only for the virtual user calling the function.

Note: You do not necessarily need to call the FileGetFirstRow function prior to the first FileGetNextRow function call. After a file has been opened, the file pointer is set to the first row automatically.

Include file

Kernel.bdh

Syntax

FileGetNextRow(in hFile: number): number;

Return value

row number for the current row (beginning with 1 for the first row of a file)

Parameter Description
hFile Specifies the file handle that is used to access the file

Example

dcltrans
  transaction TMain
  const
    MAX_LEN := 254;
  var
    hFile, i : number;
    sColumn : string;
  begin
    FileFixedLoad(hFile, "login.csv", "1..20;21-40");
    for i := 1 to 100 do
      FileGetNextRow(hFile);
      sColumn := FileGetCol(hFile, 1, MAX_LEN);
    end;
    ...
  end TMain;

Sample scripts

RandomLogin.bdf