I have a project that is to result in Web services. It uses a connection pool that uses single use IDs. If an error should occur for some unpredictable reason HATS will terminate the session. When this occurs, does HATS run the Disconnect macro before terminating the session?
If it does not run that macro the host session will simply disconnect leaving the host to deal with an idle session timeout in order to release that user ID for reuse. HATS will then place the user ID back in the queue to be reused. If HATS needs to start another session and selects that same user ID, all before the host logs the user off of the prior terminal the HATS Connect macro will either fail or detect an error. In my project I will detect an error because the host will tell me that the user is currently logged onto another terminal. I could then return to the main logon screen. However, If I exit the connect macro normally, then the terminal session is not in the expected state and the ensuing macro will fail because it does not see its Start screen. To resolve that issue I would need to place code in every macro to recognize that state and return an error to the client telling them to reissue the request.
In the case were the Disconnect macro is run, I'm covered as my macro will run under any condition the host will throw and properly terminate the session. However, I'm looking for a cleaner way to handle this condition if the Disconnect macro is not run. I don't want to get into a condition where the connection fails, the ID is placed back into the queue only to be immediately reused and the condition repeat. Is there a way to exit the macro and tell HATS that the user ID is temporarily unavailable and to select a different user ID from the pool, or place the request back into the pending queue to wait for another connection to free up?