Listing a File
Accessing Files
4–16
107365 Tandem Computers Incorporated
Listing a File
Use the macro in Figure 4-7,
tacllist
, to format, paginate, and print TACL program
files. This macro calls #REQUESTER to read the TACL file, copies the TACL file to a
disk file designated as the OUT file in TFORM format, and then calls TFORM to
format and print the file.
Tacllist
displays the following:
A listing banner with the TACL file date and the current date.
The contents of the file, including line numbers and page numbers.
Note
Figure 4-7 shows the use of a macro for a more complex set of operations. Because a macro cannot use
the #ARGUMENT built-in function, the macro must provide more argument checking capabilities. In
addition, the macro cannot use the #RETURN built-in function, so it uses a series of #IF calls. The bulk of
the code resides in the innermost #IF statement, making the program more difficult to read.
You can use the TFORM \NEW command within the TACL file to cause TFORM to
advance to the top of a new page. When you insert a directive of the form ==\NEW in
the file to be printed,
tacllist
replaces it with \NEW. The macro sets the page
width to 132 characters.
To preview your output before printing, specify your terminal name as the output file.
Following a preview, reinvoke
tacllist
to get a printed listing. To run this macro,
load the file and enter:
tacllist
infilename [outfilename]
If
outfilename
already exists, TACL purges the file. If you do not specify a result
file,
tacllist
writes to a file called TACLTFRM.
Figure 4-7. Listing a File (Page 1 of 5)
?SECTION tacllist MACRO
#FRAME
#PUSH err_inp rec_inp prompt default_outfile
#PUSH line_num line page_num page_out bin_date file_date
#PUSH list_date year month day file_hour file_min
#PUSH list_hour list_min short_stars long_stars
#PUSH lines_out max_lines match_string printer
#PUSH #OUTFORMAT #WIDTH
#SET printer $S.#LP5 == Put local printer name here
#SET max_lines 55 == Set to maximum lines/page
#SET default_outfile TACLTFRM == Default output file name
#SET #WIDTH 132 == Listing wrap column
#SET #OUTFORMAT PLAIN