hi friends this is the Sarfaraz and today
I’m going to show you how we can automate a mainframe application.To be
very honest I can’t show you the actual demo of mainframe automation on my local
machine as mainframe applications are quite costly and only big organizations
can afford to bare its cost hence I am going to show you the best possible
approach to automate mainframe application. So keep watching this video.
Before starting mainframe automation first of all, you have to configure the
terminal emulator add-in UFT. Make sure you have selected the TE-add-in the Add-in
Manager while opening UFT.Now create a GUI test in UFT and go to tools option
and select GUI Testing tab and then select terminal emulator option.After
that you need to select a valid vendor name as well as the Emulator name.If the
emulator is already installed on your machine your, UFT automatically retrieves
these two values but if somehow that is not working then you can manually select
it . Now click on the validate button.if UFT is able to identify the
terminal emulator it shows OK message in green color text now you can proceed
further. Now let me tell you about the objects in a terminal emulator
application. The terminal emulator has three types of object , the first one is TeWindow the second one is TeScreen and the third one is TeField .The TeScreen object
represents the application area of the screen that is being displayed at a
particular time .By default,UFT identifies the TeScreen object using its
label property .This label property could be anything like TranID or the Title of
the screen or the first field of the screen and under the TeScreen we have
TeFields .Using this label property UFT uniquely identifies a TeScreen.
In a normal automation approach you will have to take care of
all TeScreens as well as TeFields properties .The approach which I am going
to show you, we neither need to take care of TeScreen nor TeFields properties.
I will show it at a later part of this video .Mainframe screen or TeScreen,
unlike web-based or windows-based application we don’t have to deal with
lots of objects while doing mainframe automation .The mainframe
automation becomes quite easy, as we don’t have to bother about object
identification. You just need to have good VB Scripting skills. A
mainframe screen is divided into 24 rows and 80 columns and thus we have 1920
cells in a mainframe screen.The coordinate of the first cell of the
screen would be (1,1). For a human eye the mainframe screen looks like
this but for UFT the mainframe is screen is like a grid or a
two-dimensional array.TeScreen coordinates, this is a mainframe screen
if you click anywhere on a mainframe screen and the right bottom of the
screen it shows you the position of the cursor in terms of row and column
numbers that would be the coordinate of that character being displayed on the
mainframe the screen. Now we can have a look on the TeWindow and TeScreen
property. I will use the descriptive programming approach to automate
mainframe application to avoid maintenance of object repositories so
let’s try to understand the basic property of TeWindow as well as TeScreen using which UFT will identify them . The TeWindow can be identified
using its short name and a TeScreen can be identified by its Label property.If
you want to know more about descriptive programming you can refer my post, I have mentioned the link in the description of this video. Let me walk you through to the most useful methods to automate a mainframe application. Although the UFT has provided n
number of methods to perform various operations on a terminal emulator
screen we don’t need all of them I have mentioned just five methods here.
These are GetText, SetText, SetCursor position , SendKey and Sync method and
these methods are enough from all sorts of required operation on a mainframe
screen .The simple reason behind using these methods is that on a mainframe
screen we need to perform very limited operations. I will discuss each of the
methods in detail one by one. the Get Text method, the parameter of this method
are top row, left column, bottom row and right column as I said earlier for UFT
the entire TeScreen is like a two-dimensional array just to make you
understand I have created a table having four rows and ten columns. In the example one I am retrieving values of certain
characters from third row between column 2 to 6 , the output would be HELLO and in
the example 2, I am retrieving values of entire 3rd row and 4th row, the output
would be HELLO ABC MAINFRAME. The SetText method this is a quite
simple method ,we can use the set text method to set required value to a TeField
by providing a starting row and column number, in the example I am setting a value Test123 at row five and column 12 .One thing I would like to
highlight it on a mainframe screen there are protected as well as
unprotected fields, protected fields are the disable field we can’t change their
values.We can only set values in an unprotected field .If by mistake you set
any value on a protected field of mainframe screen, the screen gets freezed and after that you won’t be able to set any value even in the unprotected fields
to unfreeze the screen you have to press the ESC Key. The set cursor position
method is used to set the cursor at the desired row and column as shown in the
example , here I am setting the cursor with position row 10 and column 5.
Send key method , the send key method is used to simulate key press operations
like page up , page down, escape, end key spacebar, Enter etc and function
keys like F 1, F 2 , F 3 etc .In the example I am pressing F3 key which is usually
used to exit from a mainframe screen Sync method , this method waits until a
response is received from the host and the emulator status is set to ready or
until a timeout is reached before continuing with the run session .In short
it waits until the next page is loaded properly .Whenever you press the Enter
key , I would recommend you to use the Sync method so that it gives mainframe session to process the request .Now we will see how can we write the actual
UFT automation script .As I said earlier
we can automate the entire mainframe application without using any object
repository just by using the five methods that we discussed earlier .To
read the actual automation script for mainframe first of all I am creating an
object of TeScreen .If you observe the description property for the TeScreen you
can notice that I have provided a generic property value label=.* for label property this helps UFT to identify all TeScreens
irrespective of their label property. To ensure that you are on the
correct screen you can retrieve any unique text value of that TeScreen that
never changes and put a check against it in a if condition .In the Step 2 I am
retrieving text from the row number 7 and in between columns 8 to
24 and displaying the output in a message box .In the Step 3 I am
setting username and password and in the Step 4 I am pressing enter key. Creating custom get text function .In
mainframe automation we really need to retrieve text values from multiple rows.
Usually, we have two validate values of a field in one particular row.Since the
get text method requires four parameters we can create our own custom
function, say GetVal with only three parameters wherein we will pass only one
value for row parameter along with start and end column values. Automating ISPF Screens. The example I
discussed was of CICS online screens the best part is that using the five
methods that we discussed earlier you can automate is ISPF screens as well. You
can validate data sets whether it is a PS file,
VSAM or a GDG file or any file you can also validate data sets using copybooks
since data set validation is not a common thing hence I am NOT discussing
that in detail if anyone is having questions please mention it in your
comment that’s it hope you have enjoyed this video

Mainframe Automation Using UFT
Tagged on:                                 

Leave a Reply

Your email address will not be published. Required fields are marked *