OpenVMS DCL calls and “Callbacks”
User exit routines, also referred to as “call-backs”, are a technique with a long history. Personally, I encountered them more than three decades ago, when using working with the SORT/MERGE utility included as part of IBM's OS/360. According to my recollection, OS/360 SORT/MERGE provided user-callbacks (referred to as “exit routines” at various stages in processing, including record-by-record calls during the input and output phases. This allowed applications to be constructed as input/output filters for the standard SORT/MERGE utility.
Call-backs have been extensively used in a variety of other contexts to provide additional processing not provided within a package (e.g., Xlib).
In OpenVMS DCL, callbacks take two forms:
In DCL, callbacks are useful for their ability to reduce duplication of common processing. It is not unusual to have many procedures that perform similar functions. Callbacks provide a way to elaborate on a processing theme without replicating the underlying code. This allows for easier maintenance and reduced costs.
The three DCL command files comprising this example may be downloaded from this page. For your convenience, the files have been packaged in a ZIP archive.
|OPENVMS-CALLBACK-EXAMPLE1.COM||This procedure executes two procedures, using different mechanisms. The first procedure is called as a library procedure from the same directory, a useful technique for invoking external DCL subroutines. The second procedure is supplied as a parameter, and is executed from the present default directory.|
|OPENVMS-CALLBACK-EXAMPLE2.COM||This procedure displays that it is being executed. It is admittedly a stub for more extensive processing.|
|OPENVMS-CALLBACK-EXAMPLE3.COM||This procedure displays that it is being executed. It is admittedly a stub for more extensive processing.|