Progress Error 2767 - Could Not Evaluate The Expression Describing The Context Of The External Funct

I'm trying to call some functions in code that was written by a different developer. The code in question uses a &GLOBAL-DEFINE constant to refer to a super procedure that handles debugging.

The code is basically as follows:
Code:
/* Calling procedure */
DEFINE VARIABLE vh1 AS HANDLE.

RUN /home/danp/code/proc1.p PERSISTENT SET vh1.

SESSION:ADD-SUPER-PROCEDURE(vh1).

RUN p-procedure IN vh1.


/* Super Procedure  proc1.p */
PROCEDURE p-procedure:
  DEFINE INPUT PARAMETER pc1 AS CHARACTER NO-UNDO.
  {&RUNDEBUG}
  /* Do  a bunch of stuff */
   RETURN.
END PROCEDURE.

When I execute the calling procedure - I get the message "Could not evaluate the expression describing the context of external function 'rundebug'. (2767).

The constant &RUNDEBUG seems to be causing the problem. It's defined elsewhere in the other developer's code as &GLOBAL-DEFINE RUNDEBUG setDebugging(""). The procedure setDebugging is defined in a different procedure.

I have tried:
1. Adding the procedure that contains "setDebugging" as a super procedure in the calling procedure.
2. Manually defining the procedure in the calling procedure.


I'm out of ideas ... can anyone point me in the right direction?

Thanks,

-Dan
 
Last edited by a moderator:

Cringer

ProgressTalk.com Moderator
Staff member
Is it just an oversight that you define an input parameter for p-procedure, but aren't actually sending one in the run statement?
 

RealHeavyDude

Well-Known Member
I think that setDebugging is not an internal procedure - it is a function. Have you tried adding the function?

Heavy Regards, RealHeavyDude.
 
Is it just an oversight that you define an input parameter for p-procedure, but aren't actually sending one in the run statement?
Cringer -

Thanks for replying - yes - I was simplifying the code for this post and forgot to add an input parameter. The actual code does correctly pass a parameter.
 
I think that setDebugging is not an internal procedure - it is a function. Have you tried adding the function?

Heavy Regards, RealHeavyDude.

RealHeavyDude -

I did try adding the function to the calling procedure - unfortunately I get the same result. Lines 3 - 7 below show how I attempted to add the function.

  1. /* Calling procedure */
  2. DEFINE VARIABLE vh1 AS HANDLE.
  3. FUNCTION setDebugging RETURNS LOGICAL (INPUT vcValue AS CHARACTER):
  4. RETURN TRUE.
  5. END FUNCTION.

  6. &GLOBAL-DEFINE RUNDEBUG setDebugging (INPUT "").

  7. RUN /home/danp/code/proc1.p PERSISTENT SET vh1.

  8. SESSION:ADD-SUPER-PROCEDURE(vh1).

  9. RUN p-procedure IN vh1 (INPUT "blah").


  10. /* Super Procedure proc1.p */
  11. PROCEDURE p-procedure:
  12. DEFINE INPUT PARAMETER pc1 AS CHARACTER NO-UNDO.
  13. {&RUNDEBUG}
  14. /* Do a bunch of stuff */
  15. RETURN.
  16. END PROCEDURE.
 

TheMadDBA

Active Member
It isn't the calling procedure that has the issue... it is the super procedure. The super procedure needs to have a local copy of that function or a forward to the handle of the persistent procedure that actually contains the function.
 
It isn't the calling procedure that has the issue... it is the super procedure. The super procedure needs to have a local copy of that function or a forward to the handle of the persistent procedure that actually contains the function.
MadDba -

Sorry for being dense ... Can you tell me how I would write (or point me to an example) of a forward to the handle of the persistent procedure?
 

TheMadDBA

Active Member
Look at the documentation for the FUNCTION statement. It has examples of how to forward a stub definition of the FUNCTION to the actual handle of the procedure that contains the function.

It would also be a good idea to read the function/procedure sections in the ABL Essentials documentation.
 

RealHeavyDude

Well-Known Member
The MadDBA is correct - the function needs to reside in the super procedure or the super procedure needs a funcation prototype forwarding the call somehere else.

Without a function prototype the ABL will always look for an internal function only. If you want the same functionality like with RUN statement ( looking the super procedure stack ) you need to use the DYNAMIC-FUNCTION statement to invoke the function.

Heavy Regards, RealHeavyDude.
 
Top