| NEXT_LIST returns one null value to show it is at the end,
then displays the first one. Note that it always does this in cache,
not on the disk. It caches the file the first time it is used, and
deletes all copies on disk. A DUMP_CACHE [dataset] writes out the file.
It puts in a record "****" to mark its place.
You could make a copy of the file before you start using it in
TEST.HLD, then DUMP_CACHE TEST.TXT, then
.label start
COPY "TEST.TXT" "TEST.HLD"
next_list test.txt
get oa$display=$next_list_item
force
.pause 1
.if $next_list_item nes " " then .goto start
DUMP_CACHE TEST.TXT
COPY "TEST.HLD" "TEST.TXT"
The first NEXT_LIST will delete all copies of TEXT.TXT from disk, so
you don't need to PURGE_FILE.
NEXT_LIST always does disk IO because it references $NEXT_LIST_ITEM
each time. Then you have to do a disk IO to get the value. So it is
not as efficient as it might be. .1 probably has the right approach.
NEXT_LIST is a holdover from V1, when efficiency was not a major
concern; you usually only had one option. In V1 it wrote the file out
each time, as Frank described in a Small Buffer article.
Ben
|
| What I have been using in many occasions is an entry form, with just one field
of 132 characters (if any records are longer in your seq file, create more
fields). The mode is /MODE=ENTRY and the file points to a logical
which you assign to the sequential file you want to read. Then you can just
go through the file record for record by doing a FOR loop:
FOR SEQFILE DO GET #X = .TEXT\\DO SCRIPT
I found that easier and faster in many occasions, and a rewind is just
starting the FOR loop again.
Ben
|