Qp0zGetAllSysEnv()--Get All System-Level Environment Variables


  Syntax
 #include <qp0z1170.h>

 int Qp0zGetAllSysEnv(char *list_buf, int  *list_buf_size,
                  int *ccsid_buf, int  *ccsid_buf_size,
                  void *reserved);  

  Service Program Name: QP0ZSYSE

  Default Public Authority: *USE

  Threadsafe: Yes

The Qp0zGetAllSysEnv() function fills in the list_buf with a list of all the system-level environment variables. The list consists of multiple null-terminated name=value strings followed by an ending null-terminator. The coded character set identifier (CCSID) associated with each name=value string is returned in the ccsid_buf buffer.


Authorities

None


Parameters

list_buf
(Input/Output) The address of the buffer to receive the null-terminated name=value list.
list_buf_size
(Input/Output) A pointer to an integer that contains the information about the size (in bytes) of the list_buf buffer. Before calling Qp0zGetAllSysEnv(), this parameter should be set to the size of list_buf. If the size of this parameter is large enough to receive the list, then this field will be set to the exact size of the list upon returning from Qp0zGetAllSysEnv(). If the size of this parameter is not large enough to receive the list, then this field will contain the exact size required and ENOSPC will be the return value. In this case, the list_buf is not modified.
ccsid_buf
(Input/Output) The address of the buffer to receive the CCSIDs of the environment variables. The order of the CCSIDs returned corresponds to the order of the variables returned in the list_buf
ccsid_buf_size
(Input/Output) A pointer to an integer that contains the information about the size (in bytes) of the ccsid_buf buffer. Before calling Qp0zGetAllSysEnv(), this should be set to the size of ccsid_buf. If this size is enough to receive the CCSID list, then this field will contain the exact size of the CCSIDs received upon returning from Qp0zGetAllSysEnv(). If this size is not enough to receive the CCSID list, then this field will contain the exact size required and ENOSPC will be the return value. In this case, the ccsid_buf is not modified.
reserved
(Input) Reserved for future use. Currently, the only allowed value is NULL.

Return Value

0 Qp0zGetAllSysEnv() was successful. The list_buf contains the null-terminated system-level environment variable strings, and the ccsid_buf contains the CCSID of each variable in the same order. The list_buf_size contains the exact size of the environment variable list, and the ccsid_buf_size contains the exact size of the CCSID list.
errval Qp0zGetAllSysEnv() was not succesful. errval indicates the error.


Error Conditions

If Qp0zGetAllSysEnv() 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.

There were no system-level environment variables.

[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 buffers to receive the list and the CCSIDs was not enough. The list_buf_size and ccsid_buf_size parameters indicate the exact size needed for the list_buf ccsid_buf respectively.

[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

  1. See the example in Qp0zPutSysEnv()--Change or Add a System-Level Environment.
  2. See the two-part example in Example: Saving and restoring system-level environment variables.


API introduced: V4R4

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