RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

Retrieve Call Stack (QWVRCSTK) API Exmple Print E-mail
User Rating: / 0
PoorBest 
Written by Chamara Withanachchi   

  D GetCaller       PR                  Extpgm('QWVRCSTK')
  D                             2000
  D                               10I 0
  D                                8    CONST
  D                               56
  D                                8    CONST
  D                               15

  D Var             DS          2000
  D  BytAvl                       10I 0
  D  BytRtn                       10I 0
  D  Entries                      10I 0
  D  Offset                       10I 0
  D  EntryCount                   10I 0
  D VarLen          S             10I 0 Inz(%size(Var))
  D ApiErr          S             15

  D JobIdInf        DS
  D  JIDQName                     26    Inz('*')
  D  JIDIntID                     16
  D  JIDRes3                       2    Inz(*loval)
  D  JIDThreadInd                 10I 0 Inz(1)
  D  JIDThread                     8    Inz(*loval)

  D Entry           DS           256
  D  EntryLen                     10I 0
  D  PgmNam                       10    Overlay(Entry:25)
  D  PgmLib                       10    Overlay(Entry:35) 
  D

  C                   CallP     GetCaller(Var:VarLen:'CSTK0100':JobIdInf
  C                             :'JIDF0100':ApiErr)
  C                   Do        EntryCount
  C                   Eval      Entry = %subst(Var:Offset + 1)
  C                   Eval      Offset = Offset + EntryLen
  C                   Enddo

  C                   Eval      *InLR = *on

Thanks to AS400PRO Site


User Comments

Comment by papakyprianou on 2013-08-21 22:22:30
I have created 4 Stored Procedures to try and test above code: 
STACK1  
STACK2 
STACK3 
 
One call the other and the Stack3 calls above RPG. For some reason whatever I do I get EntryCount = 13. I even tried to go one level more with STACK4 and I still get EntryCount = 13 and not all programs in the stack are returned. 
 
Any ideas?

Please login or register to add comments

<Previous   Next>