UD NEXT - Unsave Document - Next line

(02/27/07)

PURPOSE

Retrieves a document file and sorts it by key number. Then it successively retrieves the first line (ignoring comment lines) from the stored document file. Each successive use retrieves another line from the file. Document files are stored in-core after initial use until they are cleared with 'UD NEXT E' This is useful in a loop to step thru a document file without knowing how many keys it has.   Example.

SEE ALSO

UD NEXT E [Unsave Document - End]
UD FIND [Unsave Document - Find value]
UD IC [Unsave Document - In-core, Retrieve register values]

USAGE

.OPERATION: UD NEXT [key],[r1],[r2],....
[Where: <key> returns the next document file key and [r1],[r2],........ returns up to 100 registers from that line.]

.DOCUMENT FILE: DOC998
[Enter name of the document file.]

[For example with the following document file:

;      dat/dat 16-Sep-96   AT  09:52:24    doc007.dat
1 2    22.000    142.00
2 2    101.00    202.00
11 2    111.00    712.00
3 2    102.00    303.33
100 2    112.00    613.00


The following SPIDER procedure:

DO
UD NEXT [key],[r1],[r2]
doc002
IF ([key].LE.0)  EXIT

VM
echo ' ' R1: {****[r1]} r2: {%f8.2%[r2]}
ENDDO


Will give the following output:
R1: 0022    R2: 142.00
R1: 0101    R2: 202.00
R1: 0102    R2: 303.33
R1: 0111    R2: 712.00
R1: 0112    R2: 613.00

NOTES

  1. When the end of the file is reached the returned 'key' value is zero.

  2. Keys do not have to be successively numbered. Gaps are OK in the key list.

  3. IMPORTANT: Only 12 document files may be accessed concurrently with 'UD IC', 'UD NEXT', and 'UD FIND'. Once the limit is reached one of the current files must be cleared by a 'UD ICE', 'UD NEXT E' or 'UD FIND E' operation. An attempt to apply 'UD NEXT' to a 13'th document file before execution of a 'UD ?? E ' operation to free the area reserved for data from an existing file, will result in an error.]

SUBROUTINES

UDOCIC, OPENDOC, LUNDOC

CALLER

DRIV3

© Copyright Notice /       Enquiries: spider@wadsworth.org