Read

The Read built-in extract file method reads the contents of the external file attached to the extract file into the specified frame or ispec attribute.

Before using the Read build-in method, ensure that the extract file is not empty. To do this, use the Count built-in method. You can also use Count () to keep track of the records being read by Read () and to detect the end of file (eof). For example –

Notes:

  • If you Purge an extract file or use Restart () to reset the record pointer to the start of the file, Glb.Status is set on the next Read (). This is because the next Read () is treated as the first Read ().

  • Also, using Glb.Status built-in method after every Read iteration returns or throws an error.

Syntax

<<extract file>>::Read(
elementAttribute : qualifier) : void

  

Owner

Any extract file.

Parameters

Example

In this example, Count () is used to keep track of the records being read by Read () and to detect the end of the file.

If FileA.Count () = GLB.Zeros
: File is empty
Else
      Loop While Count < FileA.Count()
           Count := Count + 1
           FileA.Read(FileA.Cust)
      End
End