Information Technology Reference
In-Depth Information
a day that will live in infamy - although I didn't know it when I wrote this topic or did the
first revision on it.
The statements
account-number = 9
read-file: readnext acctfile
we've seen before. A sequential read of the file is being done, starting with the first
record and subsequent reads until the end of the file is reached. You may ask if we could
begin at the last record and read the entire file backwards with the first record on the file
being the last record read. Think about it and I'll provide the answer at the end of chapter
23.
The verb above is for sequential reads, while
read
is used for indexed reads. For reading sequentially, the status is 0 for good reads and 9 for
end of file being reached. Anything else is a serious file error. For indexed reads, 0 status
is a good read, 5 means the record wasn't on the file anything else means deep trouble.
The next unfamiliar keyword is in the statement
perform print-headings.
It enables the printing of the headings, resulting in going to the label
print-headings ,
where each statement is executed until another label is found. The keyword
perform
is different from a
go to
statement in that control will be returned to the line in the program after the
perform .
The perform is done and then the file will be read.
The first line of the actual paragraph for printing headings
print-headings: page-counter = page-counter + 1
is another assign statement which takes whatever was in the variable
page-counter ,
adds 1 to it and that will be the new value of
page-counter .
If you go back to where that variable was defined, you will note that it initially had a
value of 0 so the result after the addition will be 1, which will be moved to the variable
page-number
on our main title line. You expect it to be 1 since this is the first page. This move is done
by the line,
page-number = page-counter ,
another assignment statement, where
page-number
can be found on the title line.
The next statement is another assignment statement that results in
Search WWH ::




Custom Search