Environment variables are character strings of the form "name=value". There are two types of environment variables:
When a job calls one of the job-level environment variable APIs or CL commands for the first time, it inherits the system-level environment variables onto its job-level environment space. Any changes to job-level and system-level environment variables are then independent of one another.
The temporary space where the job-level environment variables are stored allows read and write access. Therefore, it is possible for the space to be corrupted. This could occur if a programmer accesses the space directly using the environ array rather than using the environment variable APIs. If the space is corrupted, subsequent calls using the APIs will have unpredictable results.
Figure 1-1 lists the environment variable
functions and what they do.
Figure 1-1. Environment Variable Functions
| Function | Description |
|---|---|
| getenv() | Get value of environment variable |
| putenv() | Change or add environment variable |
| Qp0zDltEnv() | Delete an environment variable |
| Qp0zDltSysEnv() | Delete a system-level environment variable |
| Qp0zGetAllSysEnv() | Get all system-level environment variables |
| Qp0zGetEnv() | Get value of environment variable (extended) |
| Qp0zGetSysEnv() | Get value of system-level environment variable |
| Qp0zInitEnv() | Initialize environment for variables |
| Qp0zPutEnv() | Change or add environment variable (extended) |
| Qp0zPutSysEnv() | Change or add a system-level environment variable |
Note: These functions use header (include) files from the library QSYSINC, which is optionally installable. Make sure QSYSINC is installed on your system before using any of the functions. See Header Files for UNIX-Type Functions for the file and memeber name of each header file.
| Top | UNIX-Type APIs | APIs by category |
| [Information Center Home Page | Feedback ] | [Legal | AS/400 Glossary] |