Try OpenEdge Now
skip to main content
Error Handling
ABL Block Essentials : Block types : Routine-level blocks
 

Routine-level blocks

A routine is a module of code that can be called or executed from another module by referencing a routine name. In ABL, a routine-level block can be "called" in a variety of ways, such as:
*Executed by a RUN statement or a tool
*Triggered by a database event or a user-interface event
*Referenced in an assignment or expression
*Accessed from an object handle (system handle or class instance)
The routine-level blocks are:
*Procedure (also called an external procedure or .p file)
*Internal procedure
*User-defined function
*Database trigger procedure (.p file) and database trigger block (ONdatabase-event statement)
*User-interface trigger
*Class method (user-defined method), constructor, destructor, and property accessor (GET and SET methods)
Here are some important facts about routine-level blocks:
*A procedure file has an implicit block that contains all the code contained in the procedure file. Think of the implicit block as an invisible block statement (header) and an invisible END statement. End blocks placed at the end of a procedure file belong to this implicit procedure block.
*While internal procedures and user-defined functions are defined in a procedure block, at runtime these routine blocks become sub-blocks of the code that invokes the routine. In other words, the routines are not scoped to the procedure block.
*A database trigger procedure file (.p) is a block with an explicit block header statement and an implicit END statement. Place end blocks at the very end of the trigger procedure file. The compiler issues an error if you add an explicit END statement after the end blocks.
*A UI trigger can be "called" by using the APPLYevent-name syntax.