× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Patrik,

There is more than one problem, here...   I don't really have time to completely figure out how to fix it, my memories of green-screen coding are fuzzy and re-learning stuff like ERRSFL is not something I can make time for.

However, I did notice the following problems:

1) You have a variable named ErrCode that is 16A and has been left at the default value of blanks.   However, APIs use a data structure for the error code, not a character field.  The first 4 bytes of the data structure are the length, in bytes, of the structure.   Since yours are blanks, the API thinks you've provided more than 1 gb (more than one billion bytes) in which it can return error information.   (i.e. x'40404040' bytes, since blanks are x'40').   Since you've really only provided 16 bytes, any time the QMHSNDPM API returns an error, it will corrupt memory.  That is why after it fails the first time, the second time happens to crash the program.   Frankly, you're lucky that it does crash the program because you know there's an error -- if it happened to just corrupt things without crashing, this would've been much worse.

2) Your 'MsgFile' variable will have GENERICMSG at the *end* of the string rather than the start because you're doing a MOVE rather than a MOVEL.   This is why the API is sending an error to begin with, it's looking for a file named BLANK (because the first 10 posiitons of MsgFile are blank) in a library named GENERICMSG.

That's as much as I had time to look into.

Also, you say you have to code this for V4R5, but...  you are actually coding it for RPG/400 (RPG III) -- just using the RPG IV line spacing.  Even at V3R1 (which is several releases earlier than V4R5) you could've coded this in a nicer way by using RPG IV features such as EVAL and IF/ELSE/WHEN with expressions that would've made it much easier to see the mistakes you're making and much easier to fix.  Your coding style is over 26 years out of date, and is making it harder to write and maintain your programs.

-SK


On 1/29/2020 12:23 PM, Patrik Schindler wrote:
Hello,

I want to show messages from a message file in the message line of a DSPF with ERRSFL set. I wrote a standalone program with a DSPF to learn how to accomplish that. You can download and look here:
- https://leela.pocnet.net/~poc/msglindf.txt
- https://leela.pocnet.net/~poc/msglinpg.txt

Additionally, there's a message file QGPL/GENERICMSG (created by me) with a message HLO0001 just containing a hello for first- and second level text and *NONE for any answering parameters. (I'm using this very message file to successfully show messages with ERRMSGID and ERRSFLMSGID in some DSPFs.)

Before anyone is wondering: I'm using an old box with V4R5 for tinkering, so I can't use free or all-free. Reasons for that are out of scope for my question. :-)

I read sources I found via Google:
- https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/apis/QMHSNDPM.htm
- https://www.mcpressonline.com/programming/rpg/sending-a-program-message-in-rpg
- http://newsolutions.de/forum-systemi-as400-i5-iseries/threads/1716-QMHSNDPM

They are somewhat deviant in how the prototype variables are defined.

After the first press of F10, there's no change in display, especially, there is no message shown. After the second F10, the *PGM is ended with RNX9998. I'm stuck here, since I can't find helpful documentation for RNX9998, nor where I could be wrong with my API call.

May I kindly ask for advice?

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE - https://www.pocnet.net/poc-key.asc



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.