Examples for Defining Access Rights

Use the following examples to help define access rights.

Examples of Access Right Definitions

The following are examples of access right definitions.

Example of Granting Access to One Usercode

To grant access to one usercode as read only, specify the following:

USERCODE SMITH = READONLY;

Example of Granting Access to Two Usercodes

To grant access to two usercodes, the first as read only and the second as write only, specify the following:

USERCODE SMITH = READONLY;
USERCODE JONES = WRITEONLY;

Example of Granting Access to Two Usercodes and a Program

In this and the next example you can include a program name in your guard file list in one of the following ways:

  • Prefixed with a usercode in parentheses

  • Prefixed with an asterisk (*)

  • Not prefixed

If you do not prefix the program name with a usercode or an *, the GUARDFILE utility uses your usercode.

To grant access to two usercodes and a program, the first usercode as read only, the second usercode as write only, and the program as read and write, specify the following:

USERCODE SMITH = READONLY;
USERCODE JONES = WRITEONLY;
PROGRAM A = READWRITE; 

Example of Two Usercodes, a Program, and a Default Value

To grant access to two usercodes, a program, and a default value, the first usercode as read only, the second usercode as write only, the program as read and write, and the default value as execute only, specify the following:

DEFAULT = EXECUTEONLY;
USERCODE SMITH = READONLY;
USERCODE JONES = WRITEONLY;
PROGRAM A = READWRITE; 

Examples of the USING Form

The following examples apply the USING form in defining access rights.

Example of Granting Access to a Usercode Using a Specific Accesscode

Suppose you want usercode JONES to have write-only access, but only when usercode JONES is using accesscode GROUP1. To do this, specify

USERCODE JONES USING ACCESSCODE GROUP1 = WRITEONLY; 

Example of Granting Access to a Usercode Running a Specific Program

Suppose you want usercode JONES to have read-only access, but only when usercode JONES runs program A. To do this, specify

USERCODE JONES USING PROGRAM A = READONLY; 

Example of Several Programs Assigned Access Rights

Suppose you want to specify access rights for several programs in one statement.

You can list several program file names using commas. However, if you use a reserved word to identify a filename, a syntax error message is returned. To avoid ambiguity, you can enclose the reserved word used as a filename within quotation marks (“ “) or preface the file name with a usercode. For example, the following statement assigns read and write access rights to programs P1 and WRITE.”

USERCODE JONES USING PROGRAM P1, "WRITE" = RW; 

Example of Multiple Accesscodes Under the Same Usercode

Suppose usercode JONES has three accesscodes associated with it: FIRST, SECOND, and THIRD. You want to grant access only to FIRST (read only) and SECOND (execute only). To do this, specify

ACCESSCODE FIRST USING USERCODE JONES = READONLY;
ACCESSCODE SECOND USING USERCODE JONES = EXECUTEONLY; 

Another acceptable method for specifying this is the following:

USERCODE JONES USING ACCESSCODE FIRST=READONLY,
 SECOND=EXECUTEONLY;