The following code is a complete sample of login and logoff resource actions. The sample is tailored to a specific customer’s environment using a Top Secret resource. As such, the text of commands, prompt, and command sequences will most likely differ across deployments. Note that the resource actions wrap Javascript inside of XML.
<ResourceAction name=’ACME Login Action’>
<ResTypeAction restype=’TopSecret’>
<act>
var TSO_MORE = " ***";
var TSO_PROMPT = " READY";
var TS_PROMPT = " ?";
hostAccess.waitForString("ENTER YOUR APPLICATION NAME");
hostAccess.sendKeys("tso[enter]");
hostAccess.waitForString("ENTER USERID– ");
hostAccess.sendKeys(user + "[enter]");
hostAccess.waitForString("TSO/E LOGON");
hostAccess.sendKeys(password);
hostAccess.sendKeys("[enter]");
var pos = hostAccess.searchText(" -Nomail", false);
if (pos != 0) {
hostAccess.setCursorPos(pos);
hostAccess.sendKeys("S");
}
pos = hostAccess.searchText(" -Nonotice", false);
if (pos != 0) {
hostAccess.setCursorPos(pos);
hostAccess.sendKeys("S");
}
hostAccess.sendKeys("[enter]");
hostAccess.waitForStringAndInput(TSO_MORE);
hostAccess.sendKeys("[enter]");
hostAccess.waitForStringAndInput(TSO_MORE);
hostAccess.sendKeys("[enter]");
hostAccess.waitForStringAndInput("ISPF");
hostAccess.sendKeys("=x[enter]");
hostAccess.waitForString(TSO_PROMPT);
var resp =hostAccess.doCmd("PROFILE NOPROMPT MSGID NOINTERCOM
NOPAUSE NOWTPMSG PLANGUAGE(ENU) SLANGUAGE(ENU) NOPREFIX[enter]",
TSO_PROMPT, TSO_MORE);
hostAccess.waitForStringAndInput("ENTER LOGON:");
hostAccess.sendKeys(system + "[enter]");
hostAccess.waitForStringAndInput("USER-ID.....");
hostAccess.sendKeys(user + "[tab]" + password);
hostAccess.sendKeys("[enter]");
var stringsToHide = new java.util.ArrayList();
stringsToHide.add(password.decryptToString());
hostAccess.waitForString("==>", stringsToHide);
hostAccess.waitForInput();
hostAccess.sendKeys("[pf6]");
hostAccess.waitForInput();
</act>
</ResTypeAction>
</ResourceAction>