• 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
    OCEAN User Group

    OCEAN TechCon25 Online

    It’s an Exciting Time for IBM i !

    July 16 & 17, 2025 – ONLINE

    Two virtual days of learning, presented by an outstanding group of IBM’ers and IBM Champions, featuring leading-edge topics.

    FREE for OCEAN members!

    Register NOW!

    Annual (12-month) Individual OCEAN Memberships are $80 and a Corporate Membership is $250. A Corporate Membership would allow your entire company to have full access to the OCEAN website & video library and to attend OCEAN events at member rates. Act now because rates are increasing on August 1, 2025.

    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

  • 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