Share Session Between TaskBot / MetaBot Logic
The Share Session option is designed to achieve this. You can use this option in the Terminal Emulator command when you want to pass on the exact state of the application to the concurrently occurring TaskBot / MetaBot Logic and back.
Consider a scenario of concurrently running multiple tasks that use repetitive commands. For example, connecting to the same application multiple times from different tasks. The Share Session option gives you the ability to achieve this using a single task, which helps you to optimize your automation logic in the long run.
How to 'Share Session'?
You can create a hierarchy of TaskBot / MetaBot Logic connected by a common thread -Share Session:
- Create a Main Task that connects you to the application with the Share Session option enabled/selected using the Run Task command.
- Call other Sub Tasks that obtain the necessary data/information.
You do not need to disconnect from the application (terminal in this case) in the sub tasks; you only pass on the exact state of the application from the main task to the sub-tasks and back. This ensures that your bulky TaskBot / MetaBot Logic does not contain repetitive commands for connecting and disconnecting. This results in achieving the same results faster.
Example: Share session to access and get data from applications installed on a mainframe terminal
The following is an hypothetical example to guide you through the Share Session option.
The assumption is that you have access to a mainframe terminal with various applications installed. Typically, you would access each application using separate sessions to connect to the terminal. So, each TaskBot / MetaBot Logic comprises of repetitive commands, such as connect and disconnect (to clear the earlier data session).
With the Share Session option, you can share your existing session state between the TaskBot / MetaBot Logic.
- Create a Main Task named TE_Share_Main that calls the other Sub Tasks, namely, TE_BMIS and TE_CMIS. These sub-tasks obtain the required information from the various applications.
- In the TE_Share_Main main task, connect to the mainframe terminal using the Connect sub-command in the Terminal Emulator command.
- Enable the Share Session option.
- Include a Run Task command to call the
TE_BMIS sub-task. Ensure this task has used a set of
sub-commands such as Send Text and Set
Fields.Note: Since Share Session is enabled, the BMIS application starts in the same terminal that is connected to the TE_Share_Main main task.
- Use the Get Text and Get Field commands to obtain the required information.
- To restore the original terminal state, use the Send Text
The sub-task ends here and the control is passed on to the main task.
- Follow similar steps for the next TE_CMIS sub-task, that is, connect using the Share Session option, then use the Send Text and Set Fields set of sub-commands, and get the information using the Get Text and Get Fields sub-commands.
- Use the Send Text command to return to main task and restore the terminal to itsoriginal state.
- Create the required number of sub-tasks and return to the main task using the Share Session option.
- End the session in the main task by adding a Disconnect sub-command.