z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


close

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-close--fd---------------------------------------------------><

Function

close invokes the close callable service to close a file.

Parameters

fd
The file descriptor (a number) for the file to be closed.

Usage notes

  1. Closing a file closes, or frees, the file descriptor by which the file was known to the process. The system can then reassign the file descriptor to the same file or to another file when it is opened.
  2. Closing a file descriptor also unlocks all outstanding byte range locks that a process has on the associated file.
  3. If a file has been opened by more than one process, each process has a file descriptor. When the last open file descriptor is closed, the file itself is closed. If the file's link count is zero at that time, the file's space is freed and the file becomes inaccessible. When the last open file descriptor for a pipe or FIFO special file is closed, any data remaining in the file is discarded.

Example

In the following example, assume that fd was assigned a value earlier in the exec:
"close" fd

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014