GETUSER: Retrieving a User ID

How to:

The GETUSER function retrieves the ID of the connected user. GETUSER can also retrieve the name of a z/OS batch job if you run the function from the batch job.

Syntax: How to Retrieve a User ID

GETUSER(output)

where:

output

Alphanumeric, at least A8

Is the result field, whose length depends on the platform on which the function is issued. Provide a length as long as required for your platform; otherwise the output will be truncated.

Example: Retrieving a User ID

GETUSER retrieves the user ID of the person running the request:

DEFINE FILE EMPLOYEE
USERID/A8 WITH EMP_ID = GETUSER(USERID);
END
TABLE FILE EMPLOYEE
SUM CURR_SAL AS 'TOTAL SALARIES'
BY DEPARTMENT
HEADING
"SALARY REPORT RUN FROM USERID: <USERID"
" "
END

The output is:

SALARY REPORT RUN FROM USERID: USER1
 
DEPARTMENT   TOTAL SALARIES
----------   --------------
MIS             $108,002.00
PRODUCTION      $114,282.00