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


f_getfl

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

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

Function

f_getfl invokes the fcntl callable service to get the file status flags for a file.

Parameters

fd
The file descriptor (a number) for the file.

Usage notes

RETVAL returns the file status flags as a numeric value (see REXX predefined variables):

Flag Description
O_CREAT Create the file if it does not exist.
O_EXCL Fail if the file does exist and O_CREAT is set.
O_NOCTTY Do not make this file a controlling terminal for the calling process.
O_TRUNC If the file exists, truncate it to zero length.
O_APPEND Set the offset to EOF before each write.
O_NONBLOCK An open, read, or write on the file will not block (wait for terminal input).
O_RDWR Open for read and write.
O_RDONLY Open for read-only.
O_WRONLY Open for write-only.
O_SYNC Force synchronous updates.
You can use the open flags to test specific values. The easiest way to test a value is to convert both the RETVAL and the flags to binary data, and then logically AND them. For example, to test O_WRITE and O_TRUNC:
wrtr=D2C(O_WRITE+O_TRUNC,4))
If BITAND(D2C(retval,4),wrtr)=wrtr Then
   Do                                 /* o_write and o_trunc are set */
   End

Example

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

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014