You can read a specific line of a text file by entering a line number as an argument on the LINEIN method. In this example, line 3 is read from log.txt:
/* Read and display line 3 of file log.txt */ |
infile=.stream~new("log.txt") |
say infile~linein(3) |
You do not reduce file I/O by using specific line numbers. Because text files do not have a specific record length, Rexx must read through the file counting occurrences of line-end characters to find the line number you want.