umask

Read syntax diagramSkip visual syntax diagramumaskmaskvariable

Function

umask invokes the umask callable service to change your process's file mode creation mask. The file mode creation mask is used by the security package (RACF®) to turn off permission bits in the mode parameter specified. Bit positions that are set in the file mode creation mask are cleared in the mode of the created file. The prior umask value is returned in RETVAL in decimal format.

Parameters

mask
A permission bit mask that you specify as a three-digit number. Each digit must be in the range 0 to 7, and all digits must be specified. For more information about permissions, see Setting permissions for files and directories.
variable
The name of a variable that, on return, contains the prior umask value in octal format.

Usage notes

  1. The umask service changes the process's file creation mask. This mask controls file permission bits that are set whenever the process creates a file. File permission bits that are turned on in the file creation mask are turned off in the file permission bits of files that are created by the process. For example, if a call to the open service, BPX1OPN, specifies a mode argument with file permission bits, the process's file creation mask affects that argument. Bits that are on in the mask are turned off in the mode argument, and therefore in the mode of the created file.
  2. Only the file permission bits of new mask are used.

Example

To create a mask that sets read-write-execute permission on for the owner of the file and off for everyone else:
"umask 077"