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


creat

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

Read syntax diagramSkip visual syntax diagram
>>-creat--pathname--mode---------------------------------------><

Function

creat invokes the open callable service to open a new file. The file descriptor is returned in RETVAL.

Parameters

pathname
The pathname of a file.
mode
A three- or four-digit number, corresponding to the access permission bits. Each digit must be in the range 07, and at least three digits must be specified. For more information on permissions, see Setting permissions for files and directories.

Usage notes

Using creat is the equivalent of using the open callable service with the create, truncate, and write-only options:
  • When a file is created with the create option, the file permission bits as specified in mode are modified by the process's file creation mask (see umask) and then used to set the file permission bits of the file being created.
  • The truncate option opens the file as though it had been created earlier, but never written into. The mode and owner of the file do not change (although the change time and modification time do), but the file's contents are discarded. The file offset, which indicates where the next write is to occur, points to the first byte of the file.

Example

To open a new file, /u/lou/test.exec, with read-write-execute permission for the owner only:
"creat /u/lou/test.exec 700"

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014