Connect to Terminal

Connects to a mainframe-based application over 3270 protocol or a terminal-based application over 5250 protocol.

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

Connect to mainframe-based applications or terminal-based applications through the terminal emulator. You can connect to applications built for zSeries mainframes over the 3270 protocol, and for System i5®, eServer i5®, iSeries, or AS/400 systems over the 5250 protocol.

Important:Support for connections over 3270 and 5250 protocols with IBM® Personal Communications provider and HLLAPI standard is available starting from IBM RPA 23.0.6. Older versions connect over 3270 protocol with IBM RPA internal provider only.

This command connects with different terminal emulator providers:

  • IBM RPA internal provider

The default provider that is provisioned by the product, which you can use to connect to host sessions over 3270 protocol.

  • IBM® Personal Communications

In IBM RPA, you can use IBM® Personal Communications provider to launch and connect to zSeries mainframe-based applications over the 3270 protocol, and for System i5®, eServer i5®, iSeries, or AS/400 systems over the 5250 protocol.

  • High-level Language Application Program Interface (HLLAPI)

In IBM RPA, you can use terminal emulator providers that implement the HLLAPI standard to connect to zSeries mainframe-based applications over the 3270 protocol, and for System i5®, eServer i5®, iSeries, or AS/400 systems over the 5250 protocol.

Dependencies

  • IBM® Personal Communications

Bring your own instance and install IBM® Personal Communications on your computer to start sessions with the terminal emulator.

You must have the session saved as workstation profile (WP) to launch and connect to it with IBM RPA.

  • HLLAPI

As prerequisite you must have a terminal emulator provider that implements the HLLAPI standard, and provide the HLLAPI DLL in that provider.

HLLAPI DLLs supported:

  • IBM® Personal Communications: pcshll32.dll

You must have an active session opened in the terminal emulator provider to connect by using HLLAPI.

Supported protocols

Important:If you have FIPS enabled, the command supports only TLS connections.

The following list shows the protocols that you can use to connect to terminals:

  • SSL 2.0
  • SSL 3.0
  • TLS 1.0
  • TLS 1.1
  • TLS 1.2
  • TLS 1.3

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

terminalConnect --name(Text) --provider(TerminalProviderTypes) [--profile(Text)] [--sessionid(Text)] [--dllpath(Text)] [--hostname(Text)] [--port(Numeric)] [--lu(Text)] [--usessl(Boolean)] [--timeout(TimeSpan)] (Boolean)=value

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Provider provider Required TerminalProviderTypes The terminal provider.

See the provider parameter section for provider options.
Workstation Profile profile Required. Visible when the Provider is PCOMM. Text Path to an IBM® Personal Communications workstation profile.
HLLAPI DLL dll Required. Visible when the Provider is HLLAPI. Text Path to the HLLAPI DLL in the provider.
Session ID sessionID Required. Visible when the Provider is HLLAPI. Text The name of the session opened in the terminal provider.
Name name Required Text Name of the connection.

Use this name in the Disconnect from Terminal (terminalDisconnect) command to disconnect from the terminal.
Server Name hostname Required Text Name of the terminal emulator server used for the connection.
Port port Required Number Server port to use to connect to the terminal.
LU lu Optional Text Instructs what logical unit (LU) to use depending on the LU name.
Use TLS usessl Optional Boolean Enable it to secure the connection with TLS.

Important:Enabling FIPS restricts this command to support only TLS connections.
Timeout timeout Optional Time Span, Number, Text Maximum time to wait to connect to the terminal.

🛈 Note If no value is defined for the Timeout parameter, the bot uses the context timeout that is defined by the Set Timeout (setTimeout) command. If that command is not used on the script, the default timeout is 5 seconds.

The provider parameter

The following table displays the options available for the provider input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.

Designer mode label Script mode name Description
Internal TN3270 emulator Internal Uses the IBM RPA internal provider, which is the product default provider.
IBM® Personal Communications PCOMM Uses the IBM® Personal Communications provider.
HLLAPI HLLAPI Uses the HLLAPI standard to connect to terminal emulator providers.

Output parameters

Designer mode label Script mode name Accepted variable types Description
Success value Boolean Returns True if the connection was succesfully established; otherwise, returns False.

Example

The following examples demonstrates how to connect to a terminal emulator with the supported providers. You must update the connection data to connect to a terminal host session.

Example 1: Connects to a terminal emulator over 3270 protocol with IBM RPA internal provider.

defVar --name terminalName --type String --value Terminal
defVar --name terminalServer --type String --value "www.example.com"
defVar --name port --type Numeric --value 60
defVar --name connectionSuccess --type Boolean
// Connects to a terminal emulator over 3270 protocol with IBM RPA internal provider.
terminalConnect --name "${terminalName}" --provider "Internal" --hostname "${terminalServer}" --port ${port} --usessl
if --left "${connectionSuccess}" --operator "Is_True"
	// Logs a message in IBM RPA Studio if the connection is established.
	logMessage --message "Connection to the \"${terminalServer}\" host established." --type "Info"
	// Assign a value to the field in focus on the terminal emulator screen.
	terminalSetField --index 0 --value IBM
endIf
// Disconnects from the terminal.
terminalDisconnect --name "${terminalName}"

Example 2: Connects to a terminal emulator over 5250 protocol with IBM® Personal Communications provider.

defVar --name terminalName --type String --value Terminal
defVar --name connectionSuccess --type Boolean
defVar --name wp --type String --value "C:\\IBM\\Personal Communications\\hostname.ws"
// Connects to a terminal emulator over 5250 protocol with IBM Personal Communications provider.
terminalConnect --name "${terminalName}" --provider "PCOMM" --profile "${wp}" connectionSuccess=value
if --left "${connectionSuccess}" --operator "Is_True"
	// Logs a message in IBM RPA Studio if the connection is established.
	logMessage --message "Connection to the \"${wp}\" host established." --type "Info"
	// Assign a value to the field in focus on the terminal emulator screen.
	terminalSetField --index 0 --value IBM
endIf
// Disconnects from the terminal.
terminalDisconnect --name "${terminalName}"

Example 3: Connects to a terminal emulator over 5250 protocol with IBM® Personal Communications provider through the HLLAPI standard. The session defined must be started in IBM® Personal Communications before you run this example.

defVar --name terminalName --type String --value Terminal
defVar --name connectionSuccess --type Boolean
defVar --name sessionId --type String --value A
defVar --name hllapiDll --type String --value "C:\\Program Files\\IBM\\Personal Communications\\pcshll32.dll"
// Connects to a terminal emulator over 5250 protocol with IBM Personal Communications provider through the HLLAPI standard.
terminalConnect --name "${terminalName}" --provider "HLLAPI" --sessionid "${sessionId}" --dllpath "${hllapiDll}" connectionSuccess=value
if --left "${connectionSuccess}" --operator "Is_True"
	// Logs a message in IBM RPA Studio if the connection is established.
	logMessage --message "Connection to the \"${sessionId}\" host session established." --type "Info"
	// Assign a value to the field in focus on the terminal emulator screen.
	terminalSetField --index 0 --value IBM
endIf
// Disconnects from the terminal.
terminalDisconnect --name "${terminalName}"

Limitations

Enabling FIPS restricts this command to support only TLS connections.