• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Suppress Runtime Display When Qshell Cancels

    April 27, 2005 Hey, Ted

    Tahler’s Qshell tip works great. If there is an error in a CL program that runs the Start Qshell command (STRQSH or QSH), I receive escape message QSH0005. Unfortunately, an error also causes the system to display the C runtime display when I run interactively. I have to press Enter to continue. Can I suppress the error display?

    –John

    Yes. I wish I had included that information when we ran the article you mentioned. You need to assign the value NONE to environment variable QIBM_QSH_CMD_OUTPUT.

    addenvvar  envvar(QIBM_QSH_CMD_OUTPUT) value('NONE')
    

    Here’s more information I wish I had included: I have found that it’s often advantageous to build the Qshell command in a character variable, which can be dumped when the program cancels. When I view the entire command in the dump, my problem is often obvious.

    By way of example, here’s a CL program that runs the tr (Translate) command. Let’s call it CONVERT.

    pgm parm(&FromFile &ToFile &Conv)
    
       dcl   &Conv          *char     32
       dcl   &FromFile      *char     64
       dcl   &ToFile        *char     64
    
       dcl   &Abending      *lgl
       dcl   &Command       *char    128
       dcl   &MsgID         *char      7
       dcl   &MsgDta        *char    256
       dcl   &MsgF          *char     10
       dcl   &MsgFLib       *char     10
       dcl   &MsgKey        *char      4
       dcl   &PgmName       *char     10
       dcl   &RtnType       *char      2
       dcl   &Sender        *char     80
    
       monmsg cpf0000 exec(goto ForwardMsg)
    
       /* retrieve the program name */
       sndpgmmsg msg(' ') topgmq(*same) msgtype(*info) keyvar(&msgkey)
       rcvmsg    pgmq(*same) msgtype(*info) sender(&sender) rmv(*yes)
       chgvar    &PgmName   %sst(&Sender 56 10)
    
       /* convert the data */
    
       chgvar  var(&Command) +
               value('tr' *bcat &Conv *bcat '' *cat &ToFile)
    
       addenvvar  envvar(QIBM_QSH_CMD_ESCAPE_MSG) value('Y')
       monmsg cpfa980 exec(do)
          rcvmsg msgtype(*excp) rmv(*yes)
       enddo
       addenvvar  envvar(QIBM_QSH_CMD_OUTPUT) value('NONE')
       monmsg cpfa980 exec(do)
          rcvmsg msgtype(*excp) rmv(*yes)
       enddo
       QSH cmd(&Command)
       monmsg qsh0005 exec(goto abend)
    
       /* normal end of job */
       sndpgmmsg  msgid(cpf9898) msgf(qcpfmsg) msgtype(*comp) +
                       msgdta('Program' *bcat &PgmName *bcat +
                              'completed normally')
          return
    
       /* Routine to handle unexpected errors */
    Abend:
          if &Abending then(return)
          chgvar   &Abending '1'
          dmpclpgm
    
    ForwardMsg:
          rcvmsg     msgtype(*any) msgdta(&msgdta) msgid(&msgid) +
                        rtntype(&RtnType) +
                        msgf(&msgf) sndmsgflib(&msgflib)
          if ((&RtnType *eq '02') *or   /* diagnostic */ +
              (&RtnType *eq '15') *or (&RtnType *eq '17')) do  /* *escape */
             sndpgmmsg  msgid(&msgid)  msgf(&msgflib/&msgf) msgtype(*diag) +
                       msgdta(&msgdta)
          enddo
          if (&RtnType *ne '  ') then(goto ForwardMsg)
    Escape:
       sndpgmmsg  msgid(cpf9898) msgf(qcpfmsg) msgtype(*escape) +
                    msgdta('Program' *bcat &PgmName *bcat +
                           'ended abnormally')
    endpgm
    


    The call from another program might look like this:

    
    dcl   &Conv          *char     32
    dcl   &FromFile      *char     64
    dcl   &ToFile        *char     64
    
    chgvar  &conv   value('[:lower:] [:upper:]')
    chgvar  &FromFile +
               value('/QSYS.LIB/MYLIB.LIB/MYFILE.FILE/MBR1.MBR')
    chgvar  &ToFile +
               value('/QSYS.LIB/MYLIB.LIB/MYFILE.FILE/MBR2.MBR')
    call Convert parm(&FromFile &ToFile &Conv)
    

    –Ted

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    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
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    All You Need for B2B is GIS 4.0, Sterling Says Exercises in Simplicity

    Leave a Reply Cancel reply

Volume 5, Number 17 -- April 27, 2005
THIS ISSUE
SPONSORED BY:

WorksRight Software
Advanced Systems Concepts
Guild Companies
SoftLanding Systems

Table of Contents

  • A Simple Encryption/Decryption Algorithm for Numbers
  • Suppress Runtime Display When Qshell Cancels
  • Admin Alert: Getting Ready for Single Sign-On

Content archive

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

Recent Posts

  • To Comfort The Afflicted And Afflict The Comfortable
  • How FalconStor Is Reinventing Itself, And Why IBM Noticed
  • Guru: When Procedure Driven RPG Really Works
  • Vendors Fill In The Gaps With IBM’s New MFA Solution
  • IBM i PTF Guide, Volume 27, Number 27
  • With Power11, Power Systems “Go To Eleven”
  • With Subscription Price, IBM i P20 And P30 Tiers Get Bigger Bundles
  • Izzi Buys CNX, Eyes Valence Port To System Z
  • IBM i Shops “Attacking” Security Concerns, Study Shows
  • IBM i PTF Guide, Volume 27, Number 26

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 © 2025 IT Jungle