The $HOST-ID function gives you another way to IDentify the user, but what does it mean, and how does it differ from $USER-NAME and $USER-ID? What is the difference between $HOST-ID function and $USER-NAME and $USER-ID?
Ideal
When a user logs on to an application written in Ideal, we pick up their ID identification from one of three places: a name they type into the signon panel, a CICS operator ID in TCTTEOI, or most likely, the security ID they previously used in a CESN transaction or its equivalent.
In each of these cases, Ideal finds a matching record in the PERSON table in Datacom/DB Datadictionary (DD), either by matching the entity-name or an alias. Each person can have more than one alias, with a minimum of one that matches the USERID field. An alias could be used to connect a 7-character security ID to a person that is already defined in DD with a 15-character name, or to connect multiple operator IDs to a single generic user.
Once a user has signed on to Ideal, the ENTITY-NAME from the matched person is available as $USER-NAME, and the USERID field as $USER-ID. $HOST-ID provides the value that was used to find the record, which could be the same as either of these, or it could be an alias that matches neither.
Scenario 1: External Security
This is expected to be the normal case for most sites. $HOST-ID will be the security ID used in CESN, and may or may not match the value of $USER-NAME. Many sites have added aliases to all existing users when they adopted external security, but new users have their security ID as their ENTITY-NAME and no additional alias.
Scenario 2: Express Signon via OPID
If external security is not used for express signon, the alternative is to use the value in TCTTEOI as the start point, and this is typically matched (using the alias) to the USERID field of the person. In this case, $HOST-ID and $USER-ID will have the same value.
Scenario 3: Express Signon as a Generic User
This is a variation of the above, where the OPID is an alias, but does not always match the USERID field . All three values will be different ($HOST-ID, $USER-NAME, and $USER-ID), and $HOST-ID will provide the means to distinguish one instance of the generic account from another.
Other cases are possible!