Martin:
Try this:
SUBROUTINE GET.CALLSTACK (ProgramStack)
*
** Initialize local variables
NULL$ = ''
ISNT = INDEX(OCONV(SYSTEM(33), 'MCU'), 'NT', 1)
ProgramStack = NULL$
IF ISNT THEN PATH.SEP = "\" ELSE PATH.SEP = "/"
*
** get the program CALL stack
CallStack = SYSTEM(49)
xHigh = DCOUNT(CallStack, @AM)
FOR X = xHigh TO 1 STEP -1
BPName = CallStack<X,2>
LastV = DCOUNT(BPName, PATH.SEP)
BPName = FIELD(BPName, PATH.SEP, LastV)
BPName = TRIM(BPName[2,99])
IF BPName NE NULL$ THEN
ProgramStack<1,-1> = BPName
END
NEXT X
*
** remove itself from the stack
ProgramStack = DELETE(ProgramStack, 1, 1)
*
RETURN
END
Hope this helps.
Bill
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Martin Hutchinson
> Sent: Tuesday, May 30, 2006 3:32 AM
> To: [email protected]
> Subject: [U2] Knowing where you have come from in a Unibasic
> subroutine
>
> I am looking for a command or method to determine where a
> Unibasic subroutine has been called from. Something similar
> to when you execute a debug statement and type '?'. Unidata
> obviously knows where it is when executing a called
> subroutine but can I get my hands on it at runtime? Any
> comments or ideas gratefully received.
>
> regards
>
> Martin Hutchinson
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/