3422 Old Capitol Trail – Suite 1125, Wilmington – DE 19808, United States

Modernize your VT apps: learn how to recognize and process VT screens

If you are following our blog you probably know that recently we’ve launched HostSurfer, our new legacy modernization framework integrated with z/Scope Anywhere.

What you probably don’t know yet, is that HostSurfer not only works with Mainframe and Midrange applications but also with VT, UNIX, and SHH screen-based applications.

On this article, we will to explain how to use HostSurfer to recognize and process the VT screens.Modernize VT apps

modernize VT apps

Unlike 3270 and 5250 screens, the data of the VT screen and other similar systems can be presented in parts that complete the info you see on the terminal screen. The screen content arrives from the VT host in several parts that can even replace the previously shown content. In this kind of connections, the screen information isn’t arranged in fields as in the TN3270/TN5250 connections.

In order to recognize the screen of VT or similar connections, we’ve added specific methods that will help identify and handle each part as if it were a new screen.

Below are the methods defined:

waitFor
waitForLoop
waitForBreak

WaitFor Method

This method is similar to ‘wait’ but waits until a certain condition takes place (matching rules) or times out. If it fails it will invoke ‘failureCallback’.

There are two ways to call this method:

waitFor(matchingRules, matchingCallback, failureCallback, timeout)
waitFor(matchingObj, failureCallback, timeout)

…where matchinObj is a JSON with the matching rules and its callback function.

This method allows to establish an individual until any rule matches, it will invoke ‘matchingCallbak’ afterwards.
If above doesn’t occur (because of timeout or you get an unexpected unlock) it will call ‘failureCallback’.

Using waitFor individually is useful to establish navigations and “waits” until some condition is fulfilled so you can take an action or even do another WaitFor afterwards. However, ‘waitForLoop’ might fit better.

waitForLoop Method

Just as waitFor, it will wait until a certain rule is matched, but waitForLoop will keep attending the incoming screens (or the screen parts). It will stop only when you invoke ‘waitForBreak’.

waitForBreak Method

Stops waitForLoop execution.

Example:

 var waitForRules =
        [
            {   match: [{ text: "N o t i c e", col: 31 }],
                function() { 
                    log("Notice");
                    log("
" + hs.getText()) + "

");
}
},
{ match: [{ text: "Username:", col: 1 }],
function() {
hs.sendKeys(myvalues.username);
hs.send.enter();
}
},
{ match: "Password:",
function() {
hs.sendKeys(myvalues.password);
hs.send.enter();
}
},
{ match: [{ "text": "logged out", "col": 16 }],
function() {
log("'logged out' found. The waitForLoop is stopped.");
hs.waitForBreak();
}
}
];

hs = new zScope.HostSurfer();
hs.on("ready", function() {
hs.waitForLoop(waitForRules, function() { alert(‘Oops!’) });
});

Using these 3 methods you have what you need to start modernizing any VT Legacy application.

Have any questions? Need help to apply HostSurfer to your project? We would be happy to offer you our assistance (no cost involved).
Contact us at support@cybelesoft.com or leave a message below.

Cheers!

Related Posts

Leave a comment