Consultor Eletrônico



Kbase P98584: Why does the PROGRAM-NAME fail to return the calling program name with persistent procedures?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/05/2007
Status: Unverified

GOAL:

Why does the PROGRAM-NAME fail to return the calling program name with persistent procedures?

CAUSE:

To get current and calling procedure names, the PROGRAM-NAME function uses the procedure call stack. The procedure call stack is an internal memory structure that Progress uses to keep track of procedure context and scope. When a persistent procedure is created, it no longer appears on the procedure call stack. Only its triggers and internal procedures go on the call stack when they execute other procedures.

FIX:

To work around this use the PRIVATE-DATA attribute to store the handle of the procedure. For example, in the main block of each persistent window procedure:
{&WINDOW-NAME}:PRIVATE-DATA = STRING(THIS-PROCEDURE).
Then in the persistent procedure code where the name of the procedure is needed, create a handle and use it either like:
hProcHandle = WIDGET-HANDLE(ACTIVE-WINDOW:PRIVATE-DATA).
OR
hProcHandle = WIDGET-HANDLE({&WINDOW-NAME}:PRIVATE-DATA).
The FILE-NAME attribute can then be used to return the name of the persistent window procedure:
hProcHandle:FILE-NAME