• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Using APIs to Send Impromptu Messages, Take Two

    January 17, 2007 Hey, Ted

    The code for this story is available for download here.

    In your article, Using APIs to Send Impromptu Messages, you show how to use a message subfile to display impromptu error messages from an RPG program. The logic works great if you call the message-handling APIs from the main logic. However, when I move the API calls into subprocedures, your technique breaks down. What do I need to do?

    –Chris

    The problem is that you are now sending messages from a different call stack entry. (I hesitate to use the terms “higher” and “lower” when talking about call stack entries, as they tend to confuse.) Fortunately, this is easy to fix.

    Here are the calls from the article you mention.

    SendMsg (*blanks: *blanks : Msg : %size(Msg): '*INFO': '*': 0:
             *blanks: ErrorDS); 
    ClrMsgQ ('*': *zero: *blanks: '*ALL': ErrorDS);
    

    Notice the sixth and seventh parameters of QMHSNDPM, and first two parameters of QMHRMVPM. These refer to the call stack entry and call stack counter. The asterisk in the first of those two parameters and the zero in the second one together point to the current call stack entry.

    The simple solution is to replace the asterisk with the program name, which you already have because you need it for the display file.

    QMHSNDPM (*blanks: *blanks : Msg : %size(Msg):
                       '*INFO': PgmNam: 0: *blanks: ErrorDS);
    QMHRMVPM (PgmNam: *zero: *blanks: '*ALL': ErrorDS);
    

    I have revised the example program from the previous article so that it uses subprocedures. The RPG and DDS code are available for download.

    I’m glad to see you using subprocedures. I keep telling myself that I am going to quit using subroutines completely, but I haven’t done so yet.

    –Ted

    RELATED STORY

    Using APIs to Send Impromptu Messages



                         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
    Midrange Dynamics North America

    Git up to speed with MDChange!

    Git can be lightning-fast when dealing with just a few hundred items in a repository. But when dealing with tens of thousands of items, transaction wait times can take minutes.

    MDChange offers an elegant solution that enables you to work efficiently any size Git repository while making your Git experience seamless and highly responsive.

    Learn more.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    BCD:  Try WebSmart - the easiest and most complete iSeries Web development tool
    COMMON:  Join us at the 2007 conference, April 29 – May 3, in Anaheim, California
    New Generation Software:  Leading provider of iSeries BI and financial management software

    IBM to Open Eight SOA Centers Worldwide Big Blue Readies Revamped Storage for the System i

    Leave a Reply Cancel reply

Volume 7, Number 2 -- January 17, 2007
THIS ISSUE SPONSORED BY:

WorksRight Software
SEQUEL
Patrick Townsend & Associates

Table of Contents

  • Using APIs to Send Impromptu Messages, Take Two
  • Gotcha Lurking in Datalink File Manager for DB2/400
  • Admin Alert: Ending Subsystems Properly

Content archive

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

Recent Posts

  • Public Preview For Watson Code Assistant for i Available Soon
  • COMMON Youth Movement Continues at POWERUp 2025
  • IBM Preserves Memory Investments Across Power10 And Power11
  • Eradani Uses AI For New EDI And API Service
  • Picking Apart IBM’s $150 Billion In US Manufacturing And R&D
  • FAX/400 And CICS For i Are Dead. What Will IBM Kill Next?
  • Fresche Overhauls X-Analysis With Web UI, AI Smarts
  • Is It Time To Add The Rust Programming Language To IBM i?
  • Is IBM Going To Raise Prices On Power10 Expert Care?
  • IBM i PTF Guide, Volume 27, Number 20

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