Readline. Reading large non-formatted ASCII files

Here you can download a 3gl function created by Jack Eisenberg (faster than file_load).
 
Function readline
Description     $50 = Contains the specification for the remainder of the functions The string in $50 contains:  FILENAME, OFFSET_REGISTER, STRING_REGISTER

    The FILENAME is the file that will be read - scanning for CR/LF

    The OFFSET_REGISTER is the register number which contains file offset.  If OFFSET_REGISTER value is < 0, this means begin at start of file.

     STRING_REGISTER is the register the returned string is returned in.

    The return code ($status) will be the number of characters in the line.  When an END OF FILE is reached, the value -2 will be returned.

    The OFFSET_REGISTER will be automatically updated to point to the next  part of the file.
 

Return codes -1: Function could not be located by Uniface
-2:  End-of-file reached (normal exit)
-10: File could not be located (or $50 is corrupt)
-20: Invalid offset passed to the read routine
0 - n: Number of characters returned by the read function
Example     $50 = "ASCII.TXT, 11, 12"   -   Read ASCII.TXT from offset $11 into $12

    To read through an entire file, use the program as such:

    $50 = "ASCII.TXT, 11, 12"
    $11 = -1    ; Signifies that we want to start at beginning of file
    perform "readline"      ; This reads the first line of the file into $12
    while ($status >= 0)
        ; Process the value of the string returned in $12
        ; Whose length is in register $status
        ;
        ; The call to 'readline' modified the value in $11
        perform "readline"  ; This reads the next line
    endwhile

    if ($status != -2)
        ; Abnormal end of file
    endif
 

Useqread. Acces to TXT files.

Here you can download the compiled DLL for versions 6.1dp (win311), 6.1dp(win95) and  7.1.01(win95), plus source code in C++
3gl function Use
UseqOpen $30 the path of the file
Result. if the file is found. In $31 the first record
$status = -1 when EOF
UseqNext Read the next record and load it in $31
$status = -1 when EOF