|
|
![]() |
|
|
|
|
||
|
Retrieve Qshell Exit Status in CL Programs Hey, Ted: In the article, "Using Grep to Search Source Physical Files", which published in the November 13, 2002, issue of Midrange Guru, you presented a way to extract Qshell's return code when running a Qshell utility in a CL program. I know a better way. I've been using this routine to get the return code from the QSH command in CL. DCL &MSGDTA *CHAR 4 DCL &MSGID *CHAR 7 DCL &RTNCODE *DEC (10 0) QSH CMD(whatever) RCVMSG MSGTYPE(*LAST) RMV(*NO) MSGDTA(&MSGDTA) + MSGID(&MSGID) IF (&MSGID = 'QSH0005') CHGVAR &RTNCODE %BIN(&MSGDTA)
Now &RTNCODE has the decimal value of the return code. -- Ken My thanks to Ken for this tip. I did some digging and found that Qshell sends message QSH0005 after it executes a command. If you look at that message, which is in message file QSHELL/QZSHMSGF, you'll see that the return code is a four-byte integer value in the field data. -- Ted
|
Editors
Contact the Editors |
| Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved. |