CHECKID (HL40) transaction was introduced for use with the Web Access client to SAF/RACF for authentication, but it gives a RC=20
The API returns RC 20 and no reason code
The RC=20 can occur when you're not setting up the environment by running a HL01 to initialize the API.
Resolving the problem
To resolve this issue, setup your routine to first verify if there's an existing BLG_ENVP variable, if not, setup the environment before invoking the INIT (HL01) transaction. After that, run the CHECKID (HL40) transaction to authenticate your user ID followed by a termination routine that does the TERM (HL02).