#36 Determine caller of routine / method

open
nobody
None
5
2015-07-08
2010-05-04
No

Is it possible to get the RexxContext instance of the caller of the current routine / method?
If yes I could identify the routine and sourceline i have been called from.

Or is there another way to get to these informations?

Would like to "access" something like the call stack.

Discussion

  • Michael K. J. Heihs

    Waiting for a long time !

    Could please someone answer my question?

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2015-07-07

    I too would like a way to determine the program name that called an external ooRexx function (the link provided in the previous response has no content). Apparently the PARSE instruction provides no method of accomplishing this. It would seem logical to include the calling program name with PARSE SOURCE as shown below.

    Example:

    PARSE SOURCE txtOS txtCallType txtWhoCalledMe txtWhoAmI;

    Output:

    WindowsNT FUNCTION D:\TOS\EXE\REXX\PRODUCTION\ProgA.rex D:\TOS\EXE\REXX\FuncA.rex

    txtOS = "WindowsNT"
    txtCallType = "FUNCTION"
    txtWhoCalledMe = "D:\TOS\EXE\REXX\PRODUCTION\ProgA.rex"
    txtWhoAmI = "D:\TOS\EXE\REXX\FuncA.rex"

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2015-07-07

    In the above example, if/when "txtWhoCalledMe" can not be determined, the "default" value returned would be something such as UNKNOWN.

     
  • LesK

    LesK - 2015-07-08

    The example above would break existing code, since it inserts WhoCalledMe
    before the existing WhoAmI. WhoCalledMe can't be added to the end to avoid
    the problem unless the syntax is changed to provide a special delimiter
    between the two, since WhoAmI can contain a blank on a pc. To make matters
    worse, I've been told that *nix systems allow any character in a filename,
    so what could we use as a delimiter.

    What you want is available in 4.2.0 See:

    https://sourceforge.net/p/oorexx/feature-requests/609/

    It just requires a little 'object' programming. Follow the thread to see
    some examples.

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2015-07-08

    Thanks for the quick response and your point about breaking existing code is well taken. The object solution looks promising but unfortunately, IBM is insisting its customer base do not upgrade to 4.2 due to the number of bugs they have found.

     


Anonymous

Cancel  Add attachments