Populating Current USERID in CICS map field

Populating Current USERID in CICS (COBOL) map filed is the most common requirement for the Update-able Maps. Along with USERID, getting Current date-time are also can be retrieved using the CICS supplied commands. These can be coded in COBOL program under EXEC … & END-EXEC just like any other commands.

ASSIGN USERID – ASSIGN command used to assign the current terminal user ID to the working storage variable. So that this variable can be used in performing further operating involving this user id.

For example If a user has updated the data in one screen and that userID needs to be stored in the database for audit purposes. So below command retrieves the terminal User details.

EXEC CICS ASSIGN 
     USERID(WW-USER) 
END-EXEC

Here WW-USER is the working storage variable and after the above assign command execution, ww-user contains the current terminal user id value.

ASSIGN USERNAME –  This option is to retrieve the User name which is of 20 character  and retrieved from the external security manager.

EXEC CICS ASSIGN 
     USERNAME(WW-USER-NAME) 
END-EXEC

Here Username is the working storage variable.

Apart from USERID, ASSIGN command has several other functionalities like ABCODE, ABPROGRAM, APPLID, ERRORMSG and many more. For complete list refer  the IBM link 

ABCODE is used to get the Abend code in to working storage variable as shown below.

EXEC CICS ASSIGN 
     ABCODE(WW-ABEND) 
END-EXEC

Notes:

  • ASSIGN USERID Returns 8 Byte User id of the signed User.
  • If there is no User signed in then it returns the default user id.
  • In One ASSIGN command 16 different options can be coded and if any one of the option fails, then also remaining options gets populated with the data.

Add a Comment

Your email address will not be published. Required fields are marked *

Close Bitnami banner