Processing Character Data
Developing TACL Programs
107365 Tandem Computers Incorporated
2–15
Use the macro in Figure 2-6,
volnames
, to display the volume names on your system,
using the VFIND global editing command. To run this macro, load the file and type
volnames
:
12> volnames
The volume names are:
$SYSTEM
$DATA
$DATA2
$DATA3
13>
This macro uses the OUTV construct to retrieve process output. For more information
about OUTV, see “Using INV and OUTV” in Section 5, “Initiating and Communicating
With Processes.”
Figure 2-6. Retrieving Disk Names From DSAP
?SECTION volnames MACRO
#FRAME
[#PUSH
dsapoutput == an output stack for DSAP
diskpaths == a stack of disk names
diskinfo == a single line from DSAP
volname == a volume name
displayinfo == a stack of volume names to display
count == a stack counter
begin == beginning of the volume name
end == end of the volume name
]
== Run DSAP and capture the output:
DSAP /OUTV dsapoutput/ *, SHORT
VFIND /QUIET, TO diskpaths/ dsapoutput "$"
== Set a stack counter for diskpaths
#SET count [#LINECOUNT diskpaths]
== Loop through the contents of diskpaths
[#LOOP |WHILE| [count] <> 0 |DO|
== Extract a line and put it in diskinfo
#SET diskinfo [#EXTRACT diskpaths]
== Get values for the positions of the "$" and "-"
== characters
#SETMANY volname, [diskinfo]
#APPENDV displayinfo volname
#SET count [#COMPUTE [count] - 1]
]
#OUTPUT The volume names are:
#OUTPUTV displayinfo
#UNFRAME