× 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 Fri, 12 Apr 2002, Srikanth_D wrote:

> hi all,
>
> while going through a sample program i came across the function putenv();. i
> would like to know whether any environment variables will be set before my
> program is launched, if yes how can i find out a list of them.

There are typically several environment variables set.  You can ignore all
of them unless you have a specific reason to use them.  Some common ones
are the current directory, your username, the hostname, and your path.
These may not be set on OS/400.

> i have another doubt, since environment variables are like name=value why
> can't we simply use program variables (maybe global variables). it will be
> great if somebody can tell me an exact scenario to use an environment
> variable.

Environment variables are not to be used as program variables.  A typical
environment variable use is to set preferences for an application.  For
example, you could use an environment variable to allow the user to select
their favorite way of displaying dates.  Suppose the user sets an
environment variable called DATE_FORMAT to have the value '*iso'.  Your
program could check for the existence of this environment variable and if
it is defined use the value to change your dates to display in *iso
format.

An extreme example of environment variable use is in CGI programming.  The
web server passes all data to a CGI program using environment variables.
The CGI program then looks for these environment variables and acts
according to the values they have.

James Rich
james@eaerich.com



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.