IBM i has always had the capability to display the call stack associated with a job. When threads were introduced on the system, call stacks were provided on a per-thread basis.
In V5R4, IBM made a significant enhancement to expand the information that’s displayed when viewing a call stack. Specifically, to provide improved integration and support for Java and Portable Application Solutions Environment (PASE) applications, the call stack support was enhanced to display call stack entries for Java applications, as well as applications running in PASE. The capability to display Licensed Internal Code (LIC) stack entries was also added.
You can view call stacks from the Work With Job and Display Job commands; option 11 will display the call stack of the initial thread in the job. If the job has secondary threads, you must first select the option to work with threads, from which you can find the option to display the call stack for a specific thread. In addition, the graphical user interfaces (Navigator for i and IBM Systems Director Navigator) also support viewing call stacks. To view PASE kernel or LIC call stack entries, you must have *SERVICE special authority and you need to select the option to “include” the additional call stack information. On the green-screen interface, this option is F21. On the graphical user interfaces, you can use the action drop-down menu to select the include option to enable the additional call stack information.
The type of call stack entry is identified in the “Type” column. On the graphical user interfaces, the type column isn’t displayed by default; you need to go to the “columns” dialog and select it. When it’s displayed, it’s a text description of the type of call stack entry. On the green-screen interface, the type column is abbreviated. Pressing F11 on the green-screen interface provides additional information on the call stack panels, and the third view provides an extended type column that expands upon the basic type field. You may see the following type and extended type fields:
Blank – an OPM or ILE invocation
001-999, +++ – the OPM or ILE request processor level
L – Licensed Internal Code
*LIC
P – PASE user code
*PASE_32 – PASE 32-bit
*PASE_64 – PASE 64-bit
K – Pase kernel code
*PASE_KERNEL
J – Java code
*JAVA_JIT – Java Just-in-time
*JAVA_MMI – Java Mixed Mode Interpreter
*JAVA_INTERPRET – Java Interpreted
*JAVA_GLUE – Java glue frame
In addition to the support through work management interfaces for displaying call stacks interactively, you can also get call stack information in the following ways:
- Work With JVM Jobs (WRKJVMJOB), which was new in the 6.1 release, can display the call stacks for the JVM job. Note that WRKJVMJOB is only supported for the IBM Technology for Java JVMs.
- You can use the Retrieve Call Stack API (QWVRCSTK) to retrieve the call stack for the specified thread.
- The Materialize Invocation Stack (MATINVS) MI instruction can be used to materialize the invocation stack of the current thread, or the initial thread of another process.
- When you’re using debug by doing a Start Debug (STRDBG), you can use the Display Debug (DSPDBG) command to show the status of debug mode, which will include the call stack.
- You can use the Dump Job command to dump the call stacks for all threads in the job. If you want to dump a job other than your own, use the Start Service Job (STRSRVJOB) command to identify the job (be sure to use End Service Job (ENDSRVJOB) when you done). The following DMPJOB invocation will dump the call stack entries: DMPJOB PGM(*NONE) JOBARA(*NONE) ADROBJ(*NO) JOBTHD(*THDSTK)
- The QTRC APIs allow you to dump out call stack information into a job trace. I review the QTRC APIs more in this blog post.
Other tools, such as Job Watcher and Performance Explorer, can include call stack information in their data collections. Having the call stack information as part of these data collections can be extremely valuable in doing diagnostic activities.
This blog post was edited for currency on January 26, 2020.
This blog post was originally published on IBMSystemsMag.com and is reproduced here by permission of IBM Systems Media.