You are on page 1of 1

Get Call stack history

wikibanking.info/2020/04/get-call-stack-history/

Marc April 15, 2020

In a routine, when you need to get information about the calling subroutine / program, or
the routine which called the routine which called…(etc…)… the current routine :-),
common variables are storing this information and can be easily retrieved. They are
SYSTEM() variables:

SYSTEM(1001): contains the very first called program/routine

SYSTEM(40): contains the current program (so equivalent to $APPLICATION).

SYSTEM(1029): contains all calling stack history, separated with VM and including return
codes separated with SM.

Example:

Prog TEST.POD0 call TEST.POD call TEST.POD1 call TEST.POD2 :

When displaying the content of above SYSTEM() variables in the latest TEST.POD2

SYSTEM(40) : TEST.POD2 = "current program"


SYSTEM(1001) : TEST.POD0 = "very first calling program"
SYSTEM(1029) : 3ü1ü7üTEST.POD1ÿ2ü1ü3üTEST.PODÿ1ü1ü3üTEST.POD0 =
3<SM>1<SM>7<SM>"calling program"
<VM>
2<SM>1<SM>3<SM>"calling program-1"
<VM>
1<SM>1<SM>3<SM>"calling program-2"

1/1

You might also like