How to use conditional statements with Terminal Emulator Command | Automation Anywhere

 RPA | Conditional Statements with terminal emulator package| Automation Anywhere- Part-49


A2019 conditional statements with terminal emulator package - In this blog we will discuss as to how we can use conditional statements with terminal emulator command in order to check for the screen whether it has appeared or not using A2019 Automation Anywhere which is also now known as Automation 360.

To begin with when we perform any automation regarding mainframe or terminal emulator the first and the foremost thing that comes to mind is the checking of each and every screen to appear at each stages of the automation that we are performing in our processes. So to implement these during the course of building the process we need the conditional statement i.e. using if and else statements.

So we will discuss each of the steps in detail one by one which are as follows:-

  • Login to mainframe using the connect command of terminal emulator package. In the properties section pass in the session name, hostname, port number, terminal type and connection type.
  • Then drag and drop the Get Text command to get the text from the mainframe starting at row start number 5, start column number 1 up till the row end number 5 and column end number also as 5 and store the output in a string variable data type.
  • Now use the conditional statements i.e. if command or action to check whether mainframe contains login as text on the screen or not. So in the if condition in the properties section select string condition from the condition drop down and in the source variable select the variable that we have created in the previous step, in the operator select "includes" as the operator and in the target value give login as the text that we want to check.
  • Then use the send text action to send the text on the mainframe screen followed by the enter key in the username field.
  • Then send the password text again using the send text action in the mainframe screen followed by the enter key.
  • Then send the backspace key thrice.
  • Now to list all the files and folders send the ls text using the send text command.
  • To check for the present working directory then send the pwd text using the send text command.
  • If the login text doesn't appear on the screen then in the else section drag and drop the message box and write the text that login text doesn't appear on the mainframe screen.
  • Last but not the least drag and drop the disconnect command or action to disconnect from the mainframe session to which we connected initially with the connect command or connect action.
Now let us see the code snippet for the steps that we have discussed above for which the attachment is given below.

Mainframe Automation


So with that we have come to the end of our blog where we have discussed how to use conditional statements to check for the presence of text whether it exists or not in the mainframe or not.

If you have any queries regarding this article then you can raise your queries in the comment section and I will try to resolve all your queries.

Comments