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



I long ago coded a CLP which accepted the option plus some variables to do a variety of static coded actions, according to the option. Odd I had never thought of using REXX interpret. Nice. Thanks.

I recalled that since the CLP could not handle a variable number of parameters, that I had coded '&T' [see my "DO" option example later] which made the following error a bit more obvious to me...

Note that the quoted REXX is not entirely safe, because &T will be blank for a member with a SRCTYPE of *NONE; thus a syntax error for evaluation as _'if ="*LIB"'_ Without the quoting, the value replacing &T is interpreted as a REXX variable; e.g. for a CLP /source type/ it would evaluate as _'if CLP="*LIB"'_ instead of _'if "CLP"="*LIB"'_ That is of course unlikely going to be an issue since CLP="CLP" unless a prior statement gave the variable CLP a value. Regardless...

parm('if &T = "*LIB" then "chgcurlib &N" else "chgcurlib &L"')

should be instead:

parm('if "&T"="*LIB" then "chgcurlib &N" else "chgcurlib &L"')


FWiW I finally found an old system with my CLP. It is slightly modified here, so hopefully other than the spurious 'else' it can be compiled. I dropped the CC=ChgCurLib logic and some others, but left a more complicated example only because I wanted to see how difficult it was to use the REXX to replace that logic.

My DO option for an effective DMPOBJ needed to dump a specific member, so I defined an option DO [and some others like CC for ChgCurLib]:

DO = call doopt (&c &l &n &f '&t' &b) /* dmpobj &l/&n &t */

<code>
pgm (&c &l &n &f &t &b)
dcl &c *char 02 /* PDM option; e.g. DO=DMP */
dcl &l *char 10 /* Lib; QSYS for WRKLIBPDM */
dcl &n *char 10 /* Object name or *NULL */
dcl &f *char 10 /* File name for WRKMBRPDM */
dcl &t *char 10 /* Object type or SRCTYPE */
dcl &b *char 01 /* List type M = WRKMBRPDM */
/* omitted prior logic to processing 'DO' */
else if (&c *eq DO) then(do)
if (&b *eq M) then(do)
dmpsysobj (&f *cat &n) &l 0D 50/* mbr of &F */
enddo
else cmd(do)
dmpobj &l/&n &t /* Dump object of type &T */
enddo
dspsplf qpsrvdmp splnbr(*last)
?dltsplf qpsrvdmp splnbr(*last)
monmsg cpf6801 exec(rcvmsg msgtype(*excp) rmv(*yes))
enddo
return
endpgm
</code>

It is surely not pretty, but I finally composed an equivalent using the simple REXX interpret:

DO = STRREXPRC SRCMBR(DOREX) PARM('q="''";if "&B"="M" then "DMPSYSOBJ ("||q||left("&F", 10)||left("&N",10)||q||") &L 0D 50"; else "DMPOBJ &L/&N &T"; "dspsplf qpsrvdmp splnbr(*last)"; "?dltsplf qpsrvdmp splnbr(*last)"') CMDENV(*COMMAND)

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.