• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Bring Back My Qshell Output

    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

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Focal Point Solutions Group

    A CloudSAFE Company

    The Power of Services:
    IBM Cloud and Managed Solutions

    Upgrade your business processes, and save time and resources with specialized, best-in-class IT solutions.

    Managed, Cloud, and Custom Solutions

    Managed Services

    • Infrastructure Monitoring & Management
    • Server Patching
    • Application Patching
    • Managed Backup
    • High Availability/Disaster Recovery Monitoring
    • Cloud Environment Monitoring
    • Office 365 Management
    • Endpoint Management
    • Managed Colocation

    Cloud Infrastructure

    • IBM i Private Cloud
    • IBM AIX Private Cloud
    • VMware Private Cloud
    • VMware Cloud Director
    • Multi-Tenant Cloud
    • Desktop as a Service

    Data Protection & High Availability

    • Disaster Recovery as a Service
    • Backup as a Service
    • IBM i Vaulting

    Security

    • Security Consulting
    • Remote Security Awareness Training & Education
    • Onsite Security Awareness Training & Education
    • Phishing Tests
    • Penetration Tests
    • Mail Security
    • Managed Detection & Response
    • Managed Firewall
    • Endpoint Protection
    • Vulnerability Management
    • Vendor Risk Assessments
    • Security Risk Assessments

    Professional Services

    • Server Virtualization
    • Data & Infrastructure Migrations
    • Hardware & Software Installation
    • Microsoft Office 365 Implementation & Migration
    • Infrastructure Assessments
    • IBM i Consulting
    • IBM AIX Consulting

    Focal Point provides all the tools you need to protect your data, ensure the integrity of your IT infrastructure, and keep your business running.

    Contact Focal Point to Learn More About Our IBM Solutions and Partnerships

    Follow us on LinkedIn

    focalpointsg.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    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

    Infor Re-Brands Datastream EAM, Adds New Feature IBM Creates New Power, SMB Server Divisions

    Leave a Reply Cancel reply

Volume 7, Number 26 -- July 18, 2007
THIS ISSUE SPONSORED BY:

WorksRight Software
ProData Computer Services
Twin Data

Table of Contents

  • Bring Back My Qshell Output
  • Customize the PC5250 Popup Keypad
  • Admin Alert: FTPing Save Files from Windows to i5/OS

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • IBM i Development and Modernization is Getting A Fresche Start with Some Ground-Breaking Subscriptions
  • CloudSAFE And Focal Point Solutions Group Combine Services, Unify Brands
  • Guru: Partitioning Result Sets Using SQL
  • As I See It: Elusive Connections
  • IBM i PTF Guide, Volume 25, Number 47
  • AWS Inks Deal With Connectria To Have a Power Play
  • IBM i Shops Have Alternatives to Db2 Web Query
  • Eradani Lays Waste to API Payload Restrictions
  • Four Hundred Monitor, November 15
  • Old PHP and Other PASE Apps Break on IBM i 7.5

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2023 IT Jungle