Consultor Eletrônico



Kbase P125284: Is there a way to know whether a certain internal procedure exists in a given procedure?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/6/2007
Status: Unverified

GOAL:

Is there a way to know whether a certain internal procedure exists in a given procedure?

GOAL:

How to get a listing of all internal procedures and user defined functions in a given procedure?

FIX:

Yes, the procedure handle's INTERNAL-ENTRIES attribute returns a comma-separated list containing the names of all internal procedures and user-defined functions defined in the procedure associated with the specified handle. For example, the following procedure demonstrate the use of this attribute to check whether a given internal procedure exists in the currently running procedure ( THIS-PROCEDURE ) or not:
DEFINE VARIABLE cInternalProcedureList AS CHARACTER NO-UNDO.
FUNCTION DoesThisInternalProcedureExist RETURNS LOGICAL (INPUT cString AS CHARACTER) FORWARD.
MESSAGE DoesThisInternalProcedureExist("proc4")
VIEW-AS ALERT-BOX INFO BUTTONS OK.
MESSAGE DoesThisInternalProcedureExist("proc5")
VIEW-AS ALERT-BOX INFO BUTTONS OK.
PROCEDURE proc1:
MESSAGE "proc1"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END PROCEDURE.
PROCEDURE proc2:
MESSAGE "proc2"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END PROCEDURE.
PROCEDURE proc3:
MESSAGE "proc3"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END PROCEDURE.
PROCEDURE proc4:
MESSAGE "proc4"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END PROCEDURE.
FUNCTION DoesThisInternalProcedureExist RETURNS LOGICAL (INPUT cString AS CHARACTER):
RETURN LOOKUP(THIS-PROCEDURE:INTERNAL-ENTRIES, cString) > 0.
END.