SOURCE-PROCEDURE system handle
- Last Updated: January 18, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
A handle to the procedure file that contains the original invocation (RUN statement or function invocation) of the current internal procedure or user-defined function.
Syntax
|
- attribute
- An attribute of the SOURCE-PROCEDURE handle.
- method
- A method of the SOURCE-PROCEDURE handle.
Attributes
The SOURCE-PROCEDURE handle supports all the attributes of the procedure object handle. For a list of these attributes, see the reference entry for the Procedure object handle in this section.
Methods
The SOURCE-PROCEDURE handle supports all the methods of the procedure object handle. For a list of these methods, see the reference entry for the Procedure object handle in this section.
Example
The following scenarios illustrate using SOURCE-PROCEDURE without procedure overriding, with procedure overriding, and with super and non-super RUNs:
Scenario 1: Using SOURCE-PROCEDURE without procedure overriding
The following scenario uses SOURCE-PROCEDURE without procedure overriding:
- A and B are handles of procedure files running persistently.
- proc1 is an internal procedure that resides in B.
- A says "RUN proc1 IN B," which runs B's proc1.
In this scenario:
- The original run statement for proc1 occurs in Step 3.
- Within B's proc1 (and within any proc1 that runs as a result of its original RUN statement), SOURCE-PROCEDURE is A.
Scenario 2: Using SOURCE-PROCEDURE with procedure overriding
The following scenario uses SOURCE-PROCEDURE with procedure overriding:
- A, B, and C, and X are handles of procedure files running persistently.
- B is a super procedure of A, and C is a super procedure of B.
- proc1 is an internal procedure different versions of which reside in A, B, and C.Note: This is an example of procedure overriding.
- X says "RUN proc1 IN A," which runs A's proc1.
- A's proc1 says "RUN SUPER," which runs B's proc1.
- B's proc1 says "RUN SUPER," which runs C's proc1.
In this scenario:
- The original run statement for proc1 occurs in Step 4.
- Within any version of proc1 that runs as a result of its original RUN statement, SOURCE-PROCEDURE is X.
Scenario 3: With SUPER and non-SUPER RUNs
The following scenario shows how the value of SOURCE-PROCEDURE changes when a non-super RUN occurs:
- A, B, and C are handles of procedure files running persistently.
- B is a super procedure of A, and C is a super procedure of B.
- proc1 is an internal procedure different versions of which reside in A, B, and C.
- proc2 is an internal procedure different versions of which reside in A, B, and C.
- A says "RUN proc1," which runs A's proc1.
- A's proc1 says "RUN SUPER," which runs B's proc1.
- B's proc1 says "RUN SUPER," which runs C's proc1.Note: At this point, within any proc1 that runs as a result of its original RUN statement, the value of SOURCE-PROCEDURE is A.
- C's proc1 says "RUN proc2," which runs C's proc2.Note: This is a non-super RUN.
In this scenario:
- The original RUN statement for proc1 occurs in Step 5.
- Within any proc1 that runs as a result of its original RUN statement, SOURCE-PROCEDURE is A.
- The original RUN statement for proc2 occurs in Step 8.
- Within any proc2 that runs as a result of its original RUN statement, SOURCE-PROCEDURE is C.
For a sample program that uses SOURCE-PROCEDURE, see the reference entry for the RUN SUPER statement.
Notes
- You can use SOURCE-PROCEDURE in applications that do not use super procedures.
- In the main block of a procedure, the value of SOURCE-PROCEDURE is the handle of the procedure that ran the current ABL source code or r-code file. This allows any ABL program to identify its caller, and to perform a "callback" to its caller.
- If an ABL or other client runs a procedure on an application server,
then in the procedure running on the application server, the value of SOURCE-PROCEDURE is
the Unknown value (
?).
See also
ADD-SUPER-PROCEDURE( ) method, REMOVE-SUPER-PROCEDURE( ) method, RUN SUPER statement, SUPER function, SUPER-PROCEDURES attribute, TARGET-PROCEDURE system handle