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



On 17-Apr-2012 00:53 , Dave wrote:

For those who have not seen it, I found this little demonstration of
the use of CL DEFINED variables very interesting :

http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/rbam6/definedv.htm

It states that "This is not the optimal way to do message
substitution..."

But it looks a good way to me, what IS the optimal way?

I believe the intended implication is that the message variable substitution feature of the Message Handler might best be utilized _instead of_ performing the string handling in the CLP; i.e. message variable substitution is a built-in feature of SNDPGMMSG. For example, having created a message [and perhaps previously its message file] with "Message data fields" as substitution variables using Add Message Description:

ADDMSGD MSGID(mymsgid) MSGF(mymsgf) MSG('LIBRARY &2 IS &1.') FMT((*CHAR 10) (*BIN 2)) /* &1 is library name; &2 is a counter */

Then the program could then be changed /* see lower case */ to do the following instead:

/* &SEQUENCE removed; formatted from &COUNTER value */
DCL &msgdta *CHAR 12 /* replaces &MESSAGE */
DCL &MSGLIBN *CHAR 10 STG(*DEFINED) DEFVAR(&msgdta 1)
DCL &COUNTER *INT 2 stg(*defined) defvar(&msgdta 11)
DCL &LIBL *CHAR 165
DCL &PTR *PTR ADDRESS(&LIBL)
DCL &LIBLNAME *CHAR 10 STG(*BASED) BASPTR(&PTR)
:
RTVJOBA SYSLIBL(&LIBL)
CHGVAR &COUNTER 0
DOFOR &COUNTER FROM(1) TO(15)
IF (&LIBLNAME *EQ ' ') THEN(LEAVE)
/* &SEQUENCE is defunct */
CHGVAR &MSGLIBN &LIBLNAME
SNDPGMMSG MSGID(mymsgid) MSGF(mymsgf) MSGDTA(&msgdta)
CHGVAR %OFS(&PTR) (%OFS(&PTR) + 11)
ENDDO

Regards, Chuck

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.