× 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.



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 does not explain why the first call hasn't crashed the program. If
the file is not available at runtime, I get the error predicted by Bruce
Vining.

Oh that first call corrupted your activation group, you just didn't become
aware of it until later. By replacing the first four bytes of ErrCode with
x'00000000' you told the API to return any error as an *ESCAPE message.
NOT setting it to x'00000000' told the API to return any message
replacement data to your ErrCode structure starting at byte offset 17 (base
1). Whatever was really at that storage location just got over written...
And it appears that whatever was there was important... (This is by far
the most likely cause of the RNX message)

May I kindly ask you to elaborate? I don't understand what exactly
you're referring to. Pointers to documentation and accompanying keywords >>
are highly welcomed!

I put together a presentation years ago on message handling and it covered,
among other things, how to use a subfile along with QMHSNDPM. If/when I
find it I'll send it to you offline.

Bruce

On Wed, Jan 29, 2020 at 6:06 PM Patrik Schindler <poc@xxxxxxxxxx> wrote:

Hello Scott,

I'm flattered! An answer from the master himself! :-)


Am 29.01.2020 um 21:38 schrieb Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>:

1) You have a variable named ErrCode that is 16A and has been left at
the default value of blanks.

Yes, I gleaned that from examples.

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.

Oh. Thanks for pointing out!

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.

Okay. I'm still struggling with the concept of fixed-length, blank-padded
strings and their peculiarities together with MOVE vs. MOVEL. I know the
technical difference but sometimes I just can't predict the outcome. :-)

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 does not explain why the first call hasn't crashed the program. If
the file is not available at runtime, I get the error predicted by Bruce
Vining.

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

Thank you for taking time for the Noob with the Dinosaur-Aged machine. ;-)

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.

Maybe? I'm following the docs (ILE RPG Reference v5.pdf)

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.

Thanks (again) for pointing out. I'd consider myself still a rookie in
terms of coding in RPG. I have some experience with C on Linux but that
doesn't help much. :-)

:wq! PoC

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


--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com




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.