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



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.