rewinddir (BPX1RWD, BPX4RWD) — Reposition a directory stream to the beginning

Function

The rewinddir callable service "rewinds," or resets, to the beginning of, an open directory. The next call to the readdir service reads the first entry in the directory.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1RWD): 31-bit
AMODE (BPX4RWD): 64-bit
ASC mode: Primary mode
Interrupt status: Enabled for interrupts
Locks: Unlocked
Control parameters: All parameters must be addressable by the caller and in the primary address space.

Format

The syntax format is as follows:

AMODE 64 callers use BPX4RWD with the same parameters.

Parameters

Directory_file_descriptor
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the directory file descriptor that was returned when the directory was opened (see opendir (BPX1OPD, BPX4OPD) — Open a directory).

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the rewinddir service returns 0 if the request is successful, or -1 if it is not successful.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the rewinddir service stores the return code. The rewinddir service returns Return_code only if Return_value is -1. For a complete list of possible return code values, see z/OS UNIX System Services Messages and Codes. The rewinddir service can return one of the following values in the Return_code parameter:
Return_code Explanation
EBADF The Directory_file_descriptor parameter does not represent an open directory. The following reason code can accompany the return code: JRRwdFileNotDir.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the rewinddir service stores the reason code. The rewinddir service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.

Usage notes

If the contents of the directory that you specify have changed since the directory was opened, a call to the rewinddir service resets the pointer into the directory to the beginning. A subsequent call to the readdir service reads from the start of the directory and obtains the new contents.

Characteristics and restrictions

There are no restrictions on the use of the rewinddir service.

Examples

For an example using this callable service, see BPX1RWD (rewinddir) example.