The main operation of a Proc is to move data from one of the two input buffers into one of the two output buffers to perform the desired TCL commands.
When a Proc starts or when control returns to a Proc, the primary input buffer is selected automatically as the active buffer. It contains the Proc name and any additional arguments entered when the Proc was invoked. The contents of this buffer remain the same throughout the execution of the Proc, unless specifically modified.
The secondary input buffer contains data subsequently entered by the user. The data in this buffer is volatile and overwritten by subsequent input commands. Usually, the data in this buffer should be tested for correctness, then moved to the secondary output buffer.
Data from several system processors, such as the spooler, are also placed in the secondary input buffer. For example, the last hold file entry number is placed in this buffer. The secondary input buffer is a very temporary entity, and if its contents are to be used, they should be used immediately subsequent to the execution of the processor that loaded the buffer.
The primary output buffer is used to construct a single TCL command. A carriage return is placed automatically at the end of the command in the buffer when the p command is issued.
The secondary output buffer (stack) is used to hold zero or more lines of data, which are used by other processors called by the Proc generated TCL command. Each request for terminal input is satisfied with a line of data from the stack. In the event that the called processor requests more data than exists in the stack, data is requested from the terminal. Note that the stack is really a first in, first out queue. Each line of data must be terminated by a carriage return and must be placed in the stack explicitly via an h command.
After all data has been moved to the buffer, control is passed to the primary output buffer via the p command. The command stored in the primary output buffer is executed at the TCL level and the data in the secondary output buffer, if any, is used to feed processors such as AQL. When the process ends, control returns to the Proc at which time new data may be moved to the output buffers.
See Also