#include <qp0z1170.h> int Qp0zPutEnv(const char *string, int ccsid);
|
The Qp0zPutEnv() function is an OS/400 extension to the standard putenv() function. Qp0zPutEnv() sets the value of an environment variable by altering an existing variable or creating a new variable. In addition, it specifies a CCSID (coded character set identifier) to be associated with the environment variable.
The string parameter points to a string of the form name=value, where name is the environment variable and value is the new value for it.
The name cannot contain a blank. For example,
PATH NAME=/my_lib/joe_user
is not valid because of the blank between PATH and NAME. The name can contain an equal (=) symbol, but the system interprets all characters following the first equal symbol as being the value of the environment variable. For example,
PATH=NAME=/my_lib/joe_user
will result in a value of 'NAME=/my_lib/joe_user' for the variable PATH.
Parameters
Return Value
Error Conditions
If Qp0zPutEnv() is not successful, errno indicates one of the following errors.
A referenced object is damaged. The object cannot be used.
In attempting to use an argument in a call, the system detected an address that is not valid.
While attempting to access a parameter passed to this function, the system detected an address that is not valid.
A parameter passed to this function is not valid.
For example, the string may not be in the correct format.
A function needed to allocate storage, but no storage is available.
There is not enough memory to perform the requested function. (There is a limit of 4095 environment variables per job.)
The operation failed because of an unknown system state. See any messages in the job log and correct any errors that are indicated, then retry the operation.
Usage Notes
Related Information
Example
See the example of using putenv() in putenv()--Change or Add Environment Variable.
| Top | Environment Variable APIs | APIs by category |
| [Information Center Home Page | Feedback ] | [Legal | AS/400 Glossary] |