Defining Program Structure
Developing TACL Programs
2–4
107365 Tandem Computers Incorporated
Figure 2-2. Performing a Bubble Sort With Nested #LOOP Statements (Page 2 of 2)
== Loop through all variable levels and display contents
#SET element 1
[#LOOP |DO|
#OUTPUT [stack.[element]]
#SET element [#COMPUTE e 1]
|UNTIL| (element > %1%)
]
#UNFRAME
Bubble
requests the specified number of elements and displays the results:
29> bubble 3
Enter Next Number to be Sorted...1
Enter Next Number to be Sorted...43
Enter Next Number to be Sorted...5
1
5
43
30>
The
bubble
macro does not check the data type of the argument. Therefore,
bubble
abc
causes an error:
29> bubble abc
[#IF ( ( 0 < abc) )
Expecting a constant
Or NOT
Or a string
(variable does not exist)
Or a number
Or (
30>
Use the routine in Figure 2-3,
checkfiles
, with its #IF statements and nested #CASE
statements, to perform file maintenance on a subvolume. The routine asks for an
alphanumeric starting point in the subvolume. It starts at the next file name, loops
through your current subvolume, and displays information about each file in the
subvolume.
Note
When you run
checkfiles,
you must access your local system and your node name must not be
included in your current #DEFAULTS. To remove a node name, if present, enter SYSTEM at the TACL
prompt before running
checkfiles
.