fhg
Volume 7, Number 26 -- July 18, 2007

Bring Back My Qshell Output

Published: July 18, 2007

Hey, Ted:

I just ran a CL program that has an embedded QShell script. It produced some output to my display and gave me a message that told me to press Enter. I did, and the Qshell output display went away. Now I want to bring that display back and look at the output again. Can I do that?

--Len


Yes, and it's easy. So the readers can see what you're talking about, let's look at an example. Here's a CL program that includes a QShell script.

pgm                                                       
      dcl   &Script        *char   1024 
      dcl   &QshStatus     *dec      10     value(0)
      dcl   &MsgDta        *char    256                   
      dcl   &MsgID         *char      7                   
                                                          
/* force QShell to send escape msg QSH0005 if it fails */ 
      addenvvar  envvar(QIBM_QSH_CMD_ESCAPE_MSG) +        
                    value('Y') replace(*yes)              
                                                          
      chgvar  &Script +                                   
        (+                                                
        'for CurFile in *; +                              
           do +                                           
              [[ $CurFile == ''*'' ]] && break ; +        
              [[ -d $CurFile ]] && continue ; +           
              echo Processing $CurFile; +                 
              echo Doing one thing to $CurFile; +         
              echo Doing another thing to $CurFile; +     
              echo Doing yet another thing to $CurFile; + 
              echo  I\''m finished with $CurFile; +       
                done; +                                   
         exit 0')                                         
      qsh cmd(&Script)                                              
      monmsg qsh0005 exec(do)                                       
         rcvmsg     msgtype(*LAST) rmv(*NO) msgdta(&MsgDta)  +      
             msgid(&MsgID)                                          
         if (&MsgID = 'QSH0005') chgvar &QshStatus %bin(&MsgDta 1 4)
      enddo                                                         

If I run this script, QShell processes every file in my current directory. In this case, I've loaded the loop with echo commands. In a real job, all but the first and last echo commands would be replaced by commands that did some real work, of course. My QShell terminal session looks something like this:

Processing temp2r3569101.wri                
Doing one thing to temp2r3569101.wri        
Doing another thing to temp2r3569101.wri    
Doing yet another thing to temp2r3569101.wri
I'm finished with temp2r3569101.wri         
Processing temp2save.txt                    
Doing one thing to temp2save.txt            
Doing another thing to temp2save.txt        
Doing yet another thing to temp2save.txt    
I'm finished with temp2save.txt             
Press ENTER to end terminal session.        

To bring the terminal session back, run the following command from a CL command line:

qsh cmd('echo x')

Voilą!

--Ted



                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
WORKSRIGHT SOFTWARE

Do you need area code information?
Do you need ZIP Code information?
Do you need ZIP+4 information?
Do you need city name information?
Do you need county information?
Do you need a nearest dealer locator system?

We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

Just call us and we'll arrange for 30 days FREE use of either
ZIP/CITY or PER/ZIP4.

WorksRight Software, Inc.
Phone: 601-856-8337
Fax: 601-856-9432
E-mail: software@worksright.com
Web site: www.worksright.com


Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

COMMON:  Join us at the Annual 2008 conference, March 30 - April 3, in Nashville, Tennessee
Seagull Software:  Web-enable your System i apps with LegaSuite GUI
VAULT400:  Securely archive data with Instant Back-Up & 24x7 Recovery


IT Jungle Store Top Book Picks

The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket Developers' Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
iSeries Express Web Implementer's Guide: List Price, $59.00
Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
WebFacing Application Design and Development Guide: List Price, $55.00
Can the AS/400 Survive IBM?: List Price, $49.00
The All-Everything Machine: List Price, $29.95
Chip Wars: List Price, $29.95

 

The Four Hundred
The Database Is the Computer

Another i5 Pricing Tweak: No User Cap on i5 515s

System i Skills: Building Bridges Over the Generation Gap

Mad Dog 21/21: To Avatar and Avatar Not

The Linux Beacon
Microsoft's GPL v3 Stance Puts Future of Novell Pact in Doubt

Oracle Says 11g Database Is Better, Cheaper, and Faster

NEC, Stratus Flesh Out Fault Tolerant Server Lines

Mad Dog 21/21: To Avatar and Avatar Not

Four Hundred Stuff
IBM Buys HA and Data Replication Software Maker DataMirror

NGS Takes Deconstructive Approach to Business Intelligence

Kisco Cranks Up Security Tool's Horsepower with V8

ACOM Supports Firefox with Content Manager

Big Iron
Three-Digit z Boxes Head for History

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
July 14, 2007: Volume 9, Number 28

July 7, 2007: Volume 9, Number 27

June 30, 2007: Volume 9, Number 26

June 23, 2007: Volume 9, Number 25

June 16, 2007: Volume 9, Number 24

June 9, 2007: Volume 9, Number 23

The Windows Observer
Microsoft's Software Assurance Customers On the Fence, Forrester Says

Microsoft's GPL v3 Stance Puts Future of Novell Pact in Doubt

A Potpourri of Fixes Marks A Slow Patch Tuesday

Hype Machine Prepped for Windows Server 2008 Launch

The Unix Guardian
IBM Says AIX 6 Beta Program Off to a Good Start

Oracle Says 11g Database Is Better, Cheaper, and Faster

IBM Charges 20 Percent Premium for Software Running on Power6 Cores

As I See It: The All-American Exhausting Vacation

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

WorksRight Software
ProData Computer Services
Twin Data



TABLE OF CONTENTS
Two Miscellaneous Qshell Tips

Customize the PC5250 Popup Keypad

Admin Alert: FTPing Save Files from Windows to i5/OS

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
What is holding companies back from using CASE tools?

Adopted Authority....

Data Structure Array (SORTING)

CL Question on Overrides

Problem with "cpyfrmimpf"





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement