The example in the previous section points to the first major use for persistent procedures. When you learned about internal procedures in “Using Basic ABL Constructs,” the examples all involved running an internal procedure from elsewhere in the same main procedure file (external procedure). But internal procedures are such a useful thing that you will want to run them from many different places. The only way to run an internal procedure that is not local to the caller is with a persistent procedure. In this way, running an internal procedure defined in some other procedure file is a two-step process:
  1. Run the procedure file that contains it as a persistent procedure, or alternatively, to obtain the handle of an instance of the procedure that is already running.
  2. Run the internal procedure in that handle, using this syntax:
    RUN internal-proc IN proc-handle [ ( parameters ) ].
    If the internal procedure has parameters, you pass them in the usual way.

This allows you to think of a persistent procedure as a library of useful routines you want to be able to run from anywhere in your application. Your application code can run any entry point in any running procedure instance from anywhere in the application. This greatly increases the flexibility of your application and its logic flow.