Thursday, January 26, 2012

TN3270 emulation in the TEP provides handy scripting function

I recently had a project where the customer wanted to be able to "zoom" from the Tivoli Portal into a 3270 interface application (something other than OMEGAMON in this example).  One nice feature of the Tivoli Portal you may not be aware of is that the TEP includes a TN3270 emulator, and that the emulator includes a nifty script function. 

With the script function, you can record scripts, playback scripts, edit and create custom scripts, and set up scripts to playback by default when the user goes to a specific workspace.  The scripting language includes support for things like IF/AND logic, string and substring functions, and you can even prompt the user for input to the script.  If you want help for all the script commands,  open a script and click "Help" in the script editor.  You will then be presented with help for all the script commands (I actually went and copied all the command help, and pasted it into a document to print it out).
Here's an example of how you can get into the script editor, and set up the options.  Note how you can set the startup script for the workspace. 

As a demonstration, I created a script that will logon to TSO and navigate to SDSF.  I took the product supplied $TSO script and modified it.  I added logic to prompt for UserID and Password, and then had the script navigate through the logon, and go to SDSF.  Here's the sample code:

// Customize the following variables to match
//  Set APPLID to logon to TSO

tsoName = "TSO";

if( tsoName == "ctsoa"  )

{
   msgbox( "Please customize this script for your environment before use." );
   return;
}
//  Enter the TSO APPLID
TYPE(tsoName);WAITFORSCREEN();

//   Prompt for Userid
TYPE(PROMPT("Enter USERID","USERID"));

//   Prompt for password
TYPE(PROMPT("Enter TSO password","PSWD"));

WAITFORSCREEN();

//   Enter keys to get to main ISPF screen
SendKey("ENTER");

WaitForScreen();

SendKey("ENTER");

WaitForScreen();

//   Position the cursor to enter command
Setcursor(22,14);

//    Command to navigate screen
gotoscr="=13.14";
TYPE(gotoscr);

SendKey("ENTER");

2 comments:

  1. Thanks Ed! That's pretty nifty functionality. How long did it take for this script to fully execute?

    ReplyDelete
  2. It works very quickly. It's really a matter of how long it takes to respond to the prompts (first id then password). The rest happens very quickly.

    ReplyDelete

Note: Only a member of this blog may post a comment.