|
|||||||
|
|
![]() |
|
|
|
|
||
|
Retrieve Qshell Exit Status in CL Programs, Take 3 Hey, Ted: In the November 13 and January 29 issues, you presented two ways to trap Qshell's exit status code in a CL program. You can also do the following. At the beginning of the CL program, use the Add Environment Variable command to set environment variable QIBM_QSH_CMD_ESCAPE_MSG to Y.
DCL &CMD *CHAR 256
DCL &STATUS *CHAR 6 VALUE(OK)
ADDENVVAR ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) VALUE('Y')
MONMSG MSGID(CPFA980)
QSH CMD(&CMD)
MONMSG MSGID(QSH0005) EXEC(DO)
CHGVAR &STATUS 'FAILED'
ENDDO
If you use this method, you can monitor for message QSH0005 as an escape message. --Tahler Thanks for the tip, Tahler. Setting environment variable QIBM_QSH_CMD_ESCAPE_MSG to Y causes the system to send QSH0005 as an escape message if the exit status is greater than zero. Setting this variable to Y also causes the system to always send QSH0006 (command was ended by signal number &1) and QSH0007 (command was ended by an exception) as escape messages. --Ted
|
Editors
Contact the Editors |
| Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved. |