A Proc is executed by entering the name of the corresponding Master Dictionary (MD) item at the TCL prompt. Procs can also be executed from another Proc of the same type via the ( ) command, which passes control to the second Proc, or the [ ] command, which calls the second Proc as a subroutine. Further ways in which Procs can be executed are when called from DataBasic (via a PERFORM or CHAIN statement that executes a TCL command that executes the Proc), as a Logon Proc, and via the GO command.
The main part of a Proc should not be stored in the account's MD, especially if large. One reason for this is that everything (including commands and files) is accessed via the MD and, if excessively cluttered with Procs, both access and execution times are increased. Procs are usually stored as items in a separate file created solely for Procs, say PROCFILE, with calling entries in the MD.
For example, to call the Proc named TESTING in file PROCFILE, the MD entry should be:
TESTING 001 PQN 002 (PROCFILE TESTING)
The file in which Procs are held should not contain items that might be edited or otherwise changed while a Proc is being executed. This is because Procs are executed directly (they are not copied into workspace like DataBasic programs), and a change that alters an item in the same group of the file often causes the Proc to be relocated, with unpredictable results. In particular, never execute a Proc that edits the file in which it resides, as this multiplies the likelyhood of problems manyfold. This is also an extremely good reason for not storing Procs in an MD, since the MD's contents are modified by a number of different commands.
Once a Proc is invoked, it remains in control until it is exited or control is passed to another Proc. Even when the Proc temporarily relinquishes control to a processor such as EDITOR or DataBasic, it still remains in control, because an exit from the called processor returns control to the Proc. TCL regains control if: