Hello Mike,

You wrote:
>Please pardon me for being stupid, but would you elaborate a little
>on what you are saying here? It looks as if the point is to avoid
>CPF9898 and instead use more specific message ids . . . ? Is that
>what you're getting at, or is it something else?

The point of that particular extract is exactly that -- never code
message text directly in programs, always use a message description.

SNDPGMMSG (and its equivalent APIs) allow you to send impromtu
message text as a convenience.  Impromptu message have no message ID.
Message IDs CPF9898 and CPF9897 exist primarily to allow impromptu
text to be sent for certain message types (*ESCAPE, *NOTIFY, *STATUS)
that require a message ID.

However, like so much in programming (and life for that matter), just
because you CAN do something doesn't mean you SHOULD.

The advantages of externally defined messages far outweigh the
convenience of impromtu messages.  Some of those advantages are:

        1/ Use of message substitution data that is independent of
the position occupied in the text and therefore easier to process
programmatically.

        2/ Ability to monitor for specific message IDs and use the ID
to condition subsequent processing.

        3/ Ability to reword/clarify the message text without
recompiling the program.

        4/ Ability to translate messages into different languages
without recompiling the program.

Creating a message file, adding and maintaining message descriptions,
etc. is more work than coding the text inline but you should simply
treat it as the proper way to do things and JUST DO IT**.

A basic programming tenet is to externalise as much as possible
(message text, configuration options, help text, etc.) and this
should simply become a standard part of your programming practice --
even in a single language shop.

**Slogan used in contravention of trademark rights held by major
sporting goods company making obscene profits from the work of
exploited indigneous third-world people.

Regards,
Simon Coulter.

--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists
   http://www.flybynight.com.au/

   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.