Troubleshooting
Problem
Qshell supports multiple levels of tracing to understand the environment in which a command is run and to help debug problems. They are Internal / Utility Trace, "trace" Utility, and Execution Trace. The preferred trace is the Internal / Utility Trace.
Resolving The Problem
===> ADDENVVAR ENVVAR(TRACEFILE) VALUE('/tmp/qsh_trace') LEVEL(*JOB)
1) Use commands to dynamically turn on and turn off the internal trace:
set -t # Turn on
set +t # Turn off
2) Set the environment variable QIBM_ZSH_TRACE_LEVEL=3 before starting the shell. When the shell starts, it determines the value of the QIBM_ZSH_TRACE_LEVEL environment and turns on the trace. This allows you to trace the shell starting and utilities that are run by any of the profile files. To enable the trace, execute:
===> ADDENVVAR ENVVAR(QIBM_ZSH_TRACE_LEVEL) VALUE(3) LEVEL(*JOB)
===> RMVENVVAR ENVVAR(QIBM_ZSH_TRACE_LEVEL)
3) Use the STRTRC/ENDTRC CL commands to turn on/off the internal and utility traces. Do not collect this trace unless directed to do so. The disadvantage to this method is you have to run two or more separate traces for the Qshell Interpreter (QZSHSH) and Child Jobs (QP0ZSPW*) since they are not all traced together like the two other methods above. You can turn on and off the traces for the shell interpreter job with the following CL commands:
===> STRTRC SSNID(QSHELL) JOB((*ALL/*ALL/QZSHSH)) JOBTRCTYPE(*TRCTYPE) TRCTYPE((*QSHELL *VERBOSE))
===> STRTRC SSNID(QSHELL2) JOB((*ALL/*ALL/QP0ZSPW*)) JOBTRCTYPE(*TRCTYPE) TRCTYPE((*QSHELL *VERBOSE))
===> ENDTRC SSNID(QSHELL) DTALIB(QTEMP) PRTTRC(*YES)
===> ENDTRC SSNID(QSHELL2) DTALIB(QTEMP) PRTTRC(*YES)
- The number in parenthesis is the process ID of the job running the shell.
- The value before the colon is the name of the function.
- The remainder of the line is data for the function.
alias # dump the internal alias table (shows all currently defined aliases).
command # dump the internal command table (shows cached commands and the node tree for currently defined functions).
descriptor # dump the internal descriptor table (shows all open descriptors).
file # dump the file stack (shows all open script files).
job # dump the internal job table (shows all active jobs).
nls # dump the variant character tables.
redirection # dump the internal redirection table (shows all redirected descriptors).
stack # dump the internal memory stack (shows all allocated stack blocks).
static # dump the values of static variables.
syntax # dump the syntax tables.
trap # dump the internal trap table (shows current signal actions).
variable # dump the internal variable table (shows all currently defined variables).
$ trace variable
$ set -x # Turn on execution trace
$ set +x # Turn off execution trace
> ls $HOME/testdir
+ ls /home/myUsrPrf/testdir
file1.txt file2.txt file3.txt file4.txt
$
> set +x
+ set +x
$
Additional Internal / Utility Trace option for intermittent problems:
If the problem is intermittent, add the below to the start of the QSH script being executed:
now=$(date +"%Y.%m.%d.%H.%M.%S")
export TRACEFILE=/tmp/qsh_trace_$now
set -t
That will generate a new trace for every execution of the script and each trace file name will have a unique time stamp on it.
Change the output directory from /tmp to some other valid directory which the user has write access to.
After an interval with no failures, delete the trace files which failed to capture the failure.
Monitor the growth of the output directory size. The size and count of trace files are dependent on customer application.
Related Information
Document Location
Worldwide
Historical Number
322324826
Was this topic helpful?
Document Information
Modified date:
06 December 2024
UID
nas8N1016326