Read a specific line from a file: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: changed some comments, added whitespace. -- ~~~~)
m (→‎{{header|REXX}}: changed indentation. -- ~~~~)
Line 690: Line 690:
q=linein(fileId,n) /*read the Nth line, store in Q.*/
q=linein(fileId,n) /*read the Nth line, store in Q.*/
qL=length(q) /*get the length of the record. */
qL=length(q) /*get the length of the record. */
select

when L==0 & qL==0 then say 'line' n "not found."
select
when L==0 & qL==0 then say 'line' n "not found."
when L==1 & qL==0 then say 'line' n "has a zero length."
when L==1 & qL==0 then say 'line' n "has a zero length."
otherwise say 'file' fileId "record" n '=' q
otherwise say 'file' fileId "record" n '=' q
end /*select*/
end /*select*/
exit /*stick a fork in it, we're done.*/
exit /*stick a fork in it, we're done.*/
/*┌────────────────────────────────────────────────────────────────────┐
/*┌────────────────────────────────────────────────────────────────────┐