An user exit defined in the C1UEXITS table with USE_ALTID=P which calls the Endevor API is expected to have the API actions executed under the security scope of the Endevor alternate ID
Depending on the situation, this might not happen so the API action is executed under the security scope of the user's ID
In the support case that originated this article, the situation was:
USE_ALTID=P parameter causes the user exit to be executed under the security scope of the Endevor alternate ID which is propagated to any new TCBs attached by the exit (for example, a new TCB is normally attached when calling the Endevor API)
This is done by manipulating the TCB for the task that runs the exit
This works fine when the API call done by the exit causes the API to attach a new TCB as, in this case, the new TCB will receive the security scope of the alternate ID
However, if the API TCB was already started when the exit is called (for example, if a previous exit called the API without shutting it down), the security scope will not be changed and the API action will be executed under whatever security scope was in the TCB (normally the user's ID)
Ensure that the API is shut down when the exit running with USE_ALTID=P calls it
NOTE: There is no problem if the exit tries to shut down the API while it is not up. The API front-end (which runs in the same task as the caller) will simply return to the caller with RC 0 when it finds that there is no API task around to shutdown.