fhg
Volume 7, Number 2 -- January 17, 2007

Using APIs to Send Impromptu Messages, Take Two

Published: 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


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

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


The Four Hundred
Zend Core for i5/OS Ships for OS/400 V5R3

Why the Number of Women in IT Is Decreasing

Next Generation ERP and the Rise of the Agile Organization

Mad Dog 21/21: Between y o u and i

The Linux Beacon
Red Hat Consolidates Fedora Core and Extras Development

Penguin Hatches Bare-Bones Altus Opteron Server

Why the Number of Women in IT Is Decreasing

Mad Dog 21/21: Between y o u and i

Four Hundred Stuff
IBM Patches Security Flaw in OS/400 V5R3

LXI Partners with FalconStor for VTL

Lawson Brings EMEA EAM App to the U.S.

Seagull Relaunches Farabi Tool Under BlueZone Name

Big Iron
The IT Analysts Make Their 2007 Predictions

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
January 13, 2007: Volume 9, Number 2

January 6, 2007: Volume 9, Number 1

December 30, 2006: Volume 8, Number 50

December 23, 2006: Volume 8, Number 49

December 16, 2006: Volume 8, Number 48

December 9, 2006: Volume 8, Number 47

The Windows Observer
Microsoft Unveils Windows Home Server

Patch Tuesday Yields Four Patches for 10 Vulnerabilities

Microsoft Refreshes 'Longhorn,' Delivers First 'Centro' Beta and 'Cougar' CTP

As I See It: Predictions and Poetry

The Unix Guardian
HP Readies HP-UX 11i v3 For Launch

Arrow Buys Agilysys' IT Distribution Business for $485 Million

Sun Adds Opteron Rev F Blade Server, Sets Utility Pricing

As I See It: Sweating the Little Stuff

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

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

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
Re-entrant code

Tar on qsh corrupting jar files

Starting the Qinter Subsystem

IWS1611 on CPYFRMPCD

Set Up Console Operation





 
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