× 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 4/12/2013 4:11 PM, Stone, Joel wrote:
I would like to build a command to return sysName and libName.
...
I would like the following to be functional:

GetEnvr &sysname &libname
Also
GetEnvr libname(&libname)


If I may put in a plug for RPG, with RPG you can check in advance whether the parameter was passed, rather than monitoring for exceptions.

This version requires 7.1, to skip coding a prototype and to use %parmnum.

D pi
D sysname 10a options(*nopass)
D libname 10a options(*nopass)

if %parms >= %parmnum(sysname)
and %addr(sysname) <> *null;
... set sysname
endif;

if %parms >= %parmnum(libname)
and %addr(libname) <> *null;
... set libname
endif;

This version works with any release. A bit more code, a bit less self-documenting, but still easier than monitoring for messages in CL.

D mypgm pr
D sysname 10a options(*nopass:*omit)
D libname 10a options(*nopass:*omit)
D mypgm pi
D sysname 10a options(*nopass:*omit)
D libname 10a options(*nopass:*omit)
D SYSNAME_NUM c 1
D LIBNAME_NUM c 2
/free
if %parms() >= SYSNAME_NUM
and %addr(sysname) <> *null;
... set sysname
endif;

if %parms() >= LIBNAME_NUM
and %addr(libname) <> *null;
... set libname
endif;

return;


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.