COLLECT allows a group of TSP statements to be entered before execution of the sequence.
COLLECT ;
Usage
This is particularly useful for introducing flow of control structures not directly allowed in interactive mode such as PROCs, IF-THEN-ELSE sequences, or DO or DOT loops. You will continue to be prompted for new lines in collect mode until you terminate the COLLECT mode.
Termination of the mode may be accomplished in two ways:
The EXEC command requests automatic execution of the entire range of commands just collected. Unlike its usage in interactive mode, the EXEC command takes no arguments when used to terminate collect mode.
The EXIT command may be used to return to interactive mode without executing the collected lines. The lines are stored and EXEC may be used on them interactively at any time.
While entering commands in collect mode, you may find you want to fix a typo, or modify something you've entered before requesting execution. For this reason, there are two commands that are always executed immediately, even while in collect mode - these are EDIT and DELETE. Of course, if you really mess things up, or simply change your mind, you can always abandon the effort with EXIT.
HINT: If there are PROCs or sequences of commands you find you use frequently (whether in collect mode or not) you may want to store them in external files to save having to type them more than once. Any group of TSP commands may be read from disk with the INPUT command. INPUT is functionally equivalent to collect mode, the only difference being that the commands are read from a file instead of your terminal. See the section on INPUT for more details on how to use this feature.
WARNING: You will confuse TSP if you begin a control structure in collect mode, and fail to end it properly before returning to interactive mode, e.g.:
1? COLLECT
Enter commands to be collected:
2> PROC X
3> (other statements)
4> ENDPROC <-- proper end to structure
5> EXIT
Collect mode is always entered from, and control always returned to the interactive mode.