Qp0zGetSysEnv()--Get Value of System-Level Environment Variable


  Syntax
 #include <qp0z1170.h>

 int Qp0zGetSysEnv(const char *name,
                  char *value, int *value_size,
                  int *ccsid, void *reserved);  
  Service Program Name: QP0ZSYSE

  Default Public Authority: *USE

  Threadsafe: Yes

The Qp0zGetSysEnv() function gets the value of a system-level environment variable name by searching the system-level environment variable list for a string of the form name=value. The value and the coded character set identifier (CCSID) associated with the environment variable name are returned.


Authorities

None


Parameters

name
(Input) The name of an environment variable.
value
(Input/Output) The address of the buffer to receive the value.
value_size
(Input/Output) A pointer to an integer that contains the information about the size of the value buffer. Before calling Qp0zGetSysEnv(), this parameter should contain the size of the value buffer. If the size of this parameter is large enough to receive the value, then this field will contain the exact size of value upon returning from Qp0zGetSysEnv(). If the size of this parameter is not large enough to receive the value, then this field will contain the exact size required and ENOSPC will be the return value. In this case, the value buffer is not modified.
ccsid
(Input/Output) The address of the variable to receive the CCSID associated with this variable.
reserved
(Input) Reserved for future use. Currently, the only allowed value is NULL.

Return Value

0 Qp0zGetSysEnv() successfully found the environment string. value and ccsid contain the value and CCSID for the variable name in the system-level environment variable list.
errval Qp0zGetEnv() was not successful. errval indicates the error./td>

Error Conditions

If Qp0zGetSysEnv() is not successful, errval indicates one of the following errors.

[EFAULT]

The address used for an argument is not correct.

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.

[EINVAL]

The value specified for the argument is not correct.

A function was passed incorrect argument values, or an operation was attempted on an object and the operation specified is not supported for that type of object.

An argument value is not valid, out of range, or NULL.

The value for the reserved parameter was not NULL.

[ENOENT]

No such path or directory.

The directory or a component of the path name specified does not exist.

A named file or directory does not exist or is an empty string.

No entry found for name specified.

[ENOSPC]

No space available.

The requested operations required additional space on the device and there is no space left. This could also be caused by exceeding the user profile storage limit when creating or transferring ownership of an object.

Insufficient space remains to hold the intended file, directory, or link.

The size of the value buffer was not big enough to receive the value.

[EUNKNOWN]

Unknown system state.

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

  1. No translation is done based on the CCSID. The CCSID is just stored and retrieved as an integer value associated with each environment variable.

Related Information


Example

See the example of using Qp0zGetSysEnv() in Qp0zPutSysEnv()--Change or Add a System-Level Environment.



API introduced: V4R4

[ Back to top | UNIX-Type APIs | APIs by category ]