IBM i Global

 View Only

 How can I find out which program is calling it from?

Miguel Peralta's profile image
Miguel Peralta posted Tue February 03, 2026 02:29 PM

Hello, I hope you understand what I need: I created a CL program in an application I'm not familiar with. How can I make the CL program tell me which other programs are calling it? How would I solve this? I've been told it can be done with a data area, but I don't know how. The AI ​​recommends RCVMSG or the QWVRCSTK API, but I don't know how to use them. Can you help or guide me, please?

Satid S's profile image
Satid S

Dear Miguel

This blog post should give you one possible answer to your question: Who’s calling my program ? 8 April 2020 at https://blog.faq400.com/en/db2-for-i/whos-calling-my-program/.    
               

Here is another answer: Identifying a call stack entry at https://www.ibm.com/docs/en/i/7.4.0?topic=program-identifying-call-stack-entry.      

Robert Berendt's profile image
Robert Berendt IBM Champion
Marius le Roux's profile image
Marius le Roux IBM Champion

Miguel, 

The SQL Way is easier if you do know some RPGLE (little more challenging to do in CLLE though not impossible) . 

If its just CLLE that you would like to compile and go , have a look at these two references  : 

  1. https://www.rpgpgm.com/2019/07/easiest-way-to-retrieve-programs-name.html
  2. https://code400.com/forum/forum/iseries-programming-languages/clp-clle/5459-retrieve-name-of-calling-program-in-cl

They both have valid CLLE programs you can just compile and change to suite your needs. 

HTH 

Marius

Rich Malloy's profile image
Rich Malloy IBM Champion

The call stack API is a point in time approach - when you run it, it's a "who is using it NOW". If you want to see /capture this info, I suggest turning on auditing for the program object to *ALL. This obviously assumes you have auditing already turned and that you are at least keeping your audit receivers at least for 1 day...Then, you can use the CPYAUDJRNE command with a 'ZR' entry type to see who/what has touched (called) that program object. You can use SQL to view the results over the file that gets created. Hope this helps - Rich

Göran Nilsson's profile image
Göran Nilsson

Hello Miguel,

Maybe a bit of an overkill in this particular case but there is also the VS Code Extension called "Source Orbit", if you are into that kind of development tool:
Source Orbit - Visual Studio Marketplace

Br
Göran Nilsson