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



Hello,

AFAIK, the /current/ CL method is to call the APIs. This assumes a few things -- (1) we're talking about ILE CL, (2) you're compiling on V5R4 with target release of V5R2 or later and (3) the systems are properly PTFed.


FWIW... getenv() and Qp0zGetEnv() both require support for pointers, which didn't exist until V5R4, and was buggy when V5R4 was released. So, you want to make sure you're on V5R4 and up-to-date on PTFs.

If you really want to do this in pure CL prior to V5R4, you might consider the QtmhGetEnv() API. It does not require pointers, and is available on older releases. The disadvantage is that it requires the HTTP server to be installed, but it retrieves the exact same environment variables as the other APIs (I'm sure it calls Qp0zGetEnv() under the covers) without the pointer logic.

However, again, due to the complexity of calling CALLPRC and then doing pointer logic in CL, it would (IMHO) be a much better idea to write an RPG program and give it a *CMD front end, so you could implement a RTVENVVAR command. Then, call that from CL. That way, all future applications that need environment variables can easily call your RTVENVVAR command. It'll be easy for the next programmer to read your CL code and easy to reuse your techniques.


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.