setnetconfig()--Initialize the Pointer in the Netconfig File


  Syntax

 #include <netconfig.h>

 void *setnetconfig(void);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The setnetconfig() function initializes the record pointer to the first entry in the netconfig file. The setnetconfig() function must be used before the first use of getnetconfig() function. The setnetconfig() function returns a unique handle (a pointer to the records stored in the netconfig file) to be used by the getnetconfig() function.


Parameters

None.


Authorities

The caller of setnetconfig() function must have execute (*X) authority to the /etc directory and must have read (*R) authority to the netconfig file.


Return Value

void pointer setnetconfig() was successful. A void pointer to the records stored in the netconfig file is returned.
NULL setnetconfig() was not successful. The errno global variable is set to indicate the error.


Error Conditions

If setnetconfig() is not successful, errno usually indicates one of the following errors. Under some conditions, errno could indicate an error other than those listed here.

[EACCES] Permission denied.
  • An attempt was made to access an object in a way forbidden by its object access permissions.
  • The job does not have access to the specified file, directory, component, or path.
[EAGAIN] Operation would have caused the process to be suspended.
[EBADNAME] The object name specified is not correct.
[EBUSY] Resource busy.
[ECONVERT] Conversion error.
  • One or more characters could not be converted from the source CCSID to the target CCSID.
[EDAMAGE] A damaged object was encountered.
  • A referenced object is damaged. The object cannot be used.
[EIO] Input/output error.
  • A physical input/output error occurred. A reference object may be damaged.
[EMFILE] Too many open files for this process.
  • An attempt was made to open more files than allowed by the value OPEN_MAX. The value of OPEN_MAX can be retrieved by using the sysconf() function.
[ENFILE] Too many open files in the system.
  • A system limit has been reached for the number of files that are allowed to be concurrently open in the system.
[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.
[ENOMEM] Storage allocation request failed.
  • The function needed to allocate storage, but no storage is available.
  • There is not enough memory to perform the requested function.
[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.
[ENOSYSRSC] System resources not available to complete the request.
[EPERM] Operation not permitted.
  • You must have appropriate privileges or other resources to do the requested operation.
[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.

Error Messages

Message ID Error Message Text
CPE3418 E Possible APAR condition or hardware failure.
CPFA0D4 E File system error occurred.
CPF3CF2 E Error(s) occurred during running of &1 API.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.
CPIA1C0 I The file /etc/netconfig cannot be opened by readers because another job has it open with write authority.


Usage Notes

The setnetconfig() function is used prior to using the getnetconfig() function to initialize the record pointer to the data stored in the netconfig file.

The setnetconfig() function will fail with [ENOENT] if the /etc/netconfig file does not exist. The setnetconfig() function will fail with [ECONVERT] if the data conversion required to convert the data stored in the /etc/netconfig file cannot be converted to the job CCSID.


Example

For more information, see the example for endnetconfig()--Release the Pointer in the Netconfig File.



API introduced: V4R2
Top | Remote Procedure Call (RPC) APIs | APIs by category