
Listing a File
Accessing Files
4–20
107365 Tandem Computers Incorporated
Figure 4-7. Listing a File (Page 5 of 5)
[#IF err_inp <> 1 |THEN| == Error 1 is EOF (OK)
#OUTPUT Error [err_inp]: Opening/reading file &
[file:input(0:33)]
]
#SET err_inp [#REQUESTER/WAIT/CLOSE rec_inp]
#POP #OUT
[#IF [#FILEINFO/CODE/ [file:output(0:33)]] = 101 |THEN|
TFORM/IN [file:output(0:33)], OUT [printer], NOWAIT/
]
] == end of #IF [err_inp] <> 0
|ELSE| == Error in input parameters
#OUTPUT
#OUTPUT ERROR: Missing input parameter. Format is:
#OUTPUT
#OUTPUT/COLUMN 3/TACLLIST inputfilename~[outputfilename~]
#OUTPUT
] == end of #IF NOT [#EMPTY %1%]
#UNFRAME
Figure 4-8 contains a sample listing produced by the TACLLIST macro.
Figure 4-8. TACLLIST Output
\STYLE FORM WIDTH 132 CHARS
*************************** tacllist ************************
*** Program Name: S6A Listing Date: 920415 12:21 ***
*** Program Date: 920415 12:20 Page Number: 001 ***
*************************************************************
001 ?SECTION defaultvars MACRO
002
003 == Any more pairs?
004 [#IF NOT [#EMPTY %1%] |THEN|
005
006 == Is this variable level empty?
007 [#IF [#EMPTYV %1%] |THEN|
008
009 == The variable level is empty; install default value
010 #SET %1% %2%
011 ]
012 == Call self again with the remaining arguments.
013 == Upon reaching this point, the rest
014 == of the macro is gone, so this causes a loop without
015 == any recursion.
016 %0% %3 TO *%
017 ]