Newsletters Subscriptions Media Kit About Us Contact Search Home

mgo
OS/400 Edition
Volume 3, Number 24 -- April 9, 2003

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


Sponsored By
ADVANCED SYSTEMS CONCEPTS

TOP TEN REASONS

Why You Should
Retire Query/400

Yes, there is a much better way!

Learn how you can access and present
AS/400 and iSeries
database information
without jumping through hoops.

Read More


THIS ISSUE
SPONSORED BY:

Advanced Systems Concepts
Client Server Development


BACK ISSUES

TABLE OF
CONTENTS

Retrieve Qshell Exit Status in CL Programs, Take 3

Sort on an Unprinted Field in Query/400

Reader Feedback and Insights: Free-Format RPG


Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris

Managing Editor
Shannon Pastore

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.