Run ABL Procedures
- Last Updated: October 9, 2023
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
This section describes how you can work with and run different types of ABL procedures.
Running a subprocedure
To run a procedure from within another ABL procedure, you use the RUN statement. Like the COMPILE
statement, the RUN statement has a lot of options, some of
which you learn about in later sections. For now, you can use the following simple form of
the statement:
|
If you are running a procedure file like h-CustSample.p, then the convention is to include the .p extension in the procedure name. For example, if you bring up a new Procedure Editor window again, you can enter this statement to run the sample procedure you have been working on, then press F2:
This is a little different than just pressing the F2 key in the procedure window where you are editing h-CustSample.p. When you press F2 or select you are compiling and running the current contents of the Procedure Editor window, which might be different from what
you have saved to a named file. You can compile and run a procedure without giving it a name
at all. Indeed, that is what you just did: you created a procedure containing a single
RUN statement, and then simply compiled and executed it
by pressing F2. This temporary procedure in
turn ran the named procedure you had already saved and compiled.
Now, why did you put the .p extension on
the RUN statement when you have already saved a compiled
.r version of the file out to your directory? When
you write an ABL RUN statement with a .p extension on the procedure name, the ABL Virtual Machine
(AVM) always looks first for a compiled file of the same name, but with the .r extension. If it finds it, it executes it. If it does not, it
passes the source file to the ABL compiler, which compiles it on the fly and then executes
it. In this way, your application can be a mix of compiled and uncompiled procedures while
you are developing it. If you always use the .p
extension in your RUN statements, then your procedures are
always found and executed whether they have been compiled or not. By contrast, if you
specify the .r extension in a RUN statement, then the AVM looks for only the compiled .r file, and the RUN fails if it is not
found.