![](https://pdfstore-manualsonline.prod.a.ki/pdfasset/c/5b/c5bc280c-ad0d-4138-8377-d36cca534942/c5bc280c-ad0d-4138-8377-d36cca534942-bg6a.png)
5250 Connect User’s Guide
106
Screen Synchronization
Screen synchronization has special ramifications for users of pools. If a situation
arises in which a user leaves a connection without the screen returning to its
original state, the next user will begin a session with the screen in an unexpected
state and an error will occur. To prevent this, we have a screen expression which
the user can specify in the connection pool. It is important that the last action in a
5250 Component be a correct Send Attention Key action that will result in the
session ending with the correct logon screen active.
NOTE: The last action should be an empty Map Screen action so that the 5250
Terminal component waits until the launch screen arrives before giving up the
connection. (This should happen automatically, when you create the Send
Attention Key action, but nevertheless, the last action should be the Map Screen.)
If you want to check, at runtime, for the presence of a bad screen at the end of a
user session, include a Function action at the end of your component’s action
model that executes a function similar to the one shown below:
function checkValidReleaseScreen(ScreenDoc)
{
var screenText = ScreenDoc.XPath("SCREEN").item(0).text
if((screenText.indexOf( "MENU") != -1 ||
screenText.indexOf("APLS") != -1) &&
(screenText.indexOf("COMMAND UNRECOGNIZED") == -1 ||
screenText.indexOf("UNSUPPORTED FUNCTION") == -1))
{
return true;
}
else // Write error messages to
// System.out and System.err:
{
java.lang.System.out.println("Warning - Releasing logon
connection at bad screen");
java.lang.System.err.println("Warning - Releasing logon
connection at bad screen");
return false;
}
}
In this particular example, this function checks the screen text and returns true if
the screen contains “MENU” or “APLS” and does not contain “COMMAND
UNRECOGNIZED” nor “UNSUPPORTED FUNCTION.” Otherwise it returns
false.