TACL Programming Guide
Listing a File
Accessing Files
107365 Tandem Computers Incorporated 4–19
Figure 4-7. Listing a File (Page 4 of 5)
 == The following variables keep track of the line number,
 == page number, and number of lines already written to
 == a page (for calculation of automatic page break).
 #SET line_num 1
 #SET page_num 1
 #SET lines_out 0
 #SET match_string \NEW
 #OUTPUT \STYLE FORM WIDTH 132 CHARS
 get_dates
 output_banner
 == Start the read operation; place the record into line.
 #APPEND prompt *start*
 #EXTRACTV rec_inp line
 [#LOOP |WHILE| NOT err_inp |DO|
 == If the line equals \NEW, perform a page break.
 [#IF [#MATCH *[match_string]* [line]] |THEN|
 #OUTPUT \NEW
 output_banner
 #SET lines_out 0
 == Otherwise, output the line number and the line.
 |ELSE|
 #OUTPUT/HOLD,WIDTH 3,COLUMN 1,JUSTIFY RIGHT,FILL &
 ZERO/ [line_num]
 #OUTPUT/HOLD,WIDTH 1/
 #OUTPUTV line
 #SET lines_out [#COMPUTE lines_out + 1]
 ]
 == If the page is full, issue a page break.
 [#IF (lines_out = max_lines) |THEN|
 #OUTPUT \NEW
 output_banner
 #SET lines_out 0
 ]
 == Move the next record into line.
 #APPEND prompt *start*
 #EXTRACTV rec_inp line
 == Increment the line counter.
 #SET line_num [#COMPUTE line_num + 1]
 ] == end LOOP










