Tutorials//‘Green Screen’ to Gold: Automating IBM iSeries Workflows with Power Automate Desktop
intermediate

‘Green Screen’ to Gold: Automating IBM iSeries Workflows with Power Automate Desktop

Unlock the power of mainframe automation. Use Power Automate Desktop's terminal emulation to read and write data from your legacy AS400 system, replacing manual green-screen clicks with reliable robot workflows.

NA
Narmer Abader
@narmer · Published June 3, 2026

Enterprise technology stacks are rarely homogenous. A modern Power Platform front-end often relies on a decades-old backend running on an IBM AS400 (IBM iSeries). While the reliability of these mainframes is legendary, their character-based "green screen" interfaces resist modern API integration.

Power Automate Desktop (PAD) provides a robust bridge for this exact scenario through its Terminal Emulation actions. PAD interacts with the text-based UI of an AS400 just as a human operator would—reading screen data, entering keystrokes, and navigating menus.

In this guide, I’ll walk you through building a real-world automation that authenticates into an AS400, navigates a complex menu structure, performs a data lookup, and retrieves the result—all without modifying a single line of legacy code.

The Use Case: Automating a Daily Sales Summary Check

Your finance team manually logs into a green-screen application every morning to check yesterday’s sales totals. They navigate to the Sales Summary screen, enter the previous day’s date, and jot down the final gross amount.

We will create a PAD desktop flow that:

  1. Launches the IBM i Access emulator.
  2. Attaches to the terminal session.
  3. Logs in with stored credentials.
  4. Navigates the menu tree to the sales summary report.
  5. Extracts the daily total and writes it to a text file.

Launching the Emulator and Attaching the Session

The first step is getting the terminal window open. We'll use the Run Application action to launch the IBM Client Access emulator.

textLaunching the Emulator
Run Application
  Application path: C:\Program Files\IBM\Client Access\Emulator\pcsws.exe
  Window style: Normal
  Window state: Maximized

After launching, we add Wait for Window to pause execution until the green-screen window is ready. Using a wildcard title (Session *) handles dynamic session labels.

textWaiting for the Window to Appear
Wait for Window
  Find window mode: By title and/or class
  Window title: Session *
  Wait for window: To open

Now we attach PAD's terminal engine to the emulator using the Open terminal session action. This binds PAD to the AS400 session so all subsequent terminal actions target the correct window.

textBinding PAD to the AS400 Session
Open terminal session
  Provider: HLLAPI
  Session name: A
  DLL path: C:\Windows\System32\ehlapi32.dll
Session Name

The session name in PAD must match the window title of your emulator. If the window title is "Session A", use A. If the title is "S43A", use S43A. An incorrect name will cause a "terminal session not responding" error.

Automating the Sign-On Process

With the session bound, we wait for the system sign-on prompt before typing any credentials.

textWaiting for the Sign-On Screen
Wait for text on terminal session
  Text to wait for: Sign On
  Wait for text location: Screen
  Timeout: 30

We populate the User and Password fields. To keep the flow secure, always store these values in PAD input variables or retrieve them using the Get password action.

textEntering User and Password
Set text on terminal session
  Get field by: Label
  Label: User
  Text: %AS400_Username%

Set text on terminal session
  Get field by: Label
  Label: Password
  Text: %AS400_Password%

Finally, we press the Transmit key to submit the login.

textSubmitting Login Credentials
Send key to terminal session
  Key to send: Transmit

After a successful login, the main application menu loads. We need to reach the Sales Summary screen. Assume the menu path is Option 2 (Sales)Sub-option 8 (Daily Summary).

The command line on most AS400 menus sits at Row 22, Column 7. Using Wait for text ensures the screen is fully rendered before we input anything.

textNavigating to the Sales Sub-Menu
Wait for text on terminal session
  Text to wait for: Main Menu
  Wait for text location: Screen

Set text on terminal session
  Get field by: Position
  Row: 22
  Column: 7
  Text: '2'

Send key to terminal session
  Key to send: Transmit

Wait for text on terminal session
  Text to wait for: Daily Summary
  Wait for text location: Screen

Set text on terminal session
  Get field by: Position
  Row: 22
  Column: 7
  Text: '8'

Send key to terminal session
  Key to send: Transmit

Data Entry and Retrieval

We have arrived at the Daily Summary screen. The screen prompts for a date with the label Period Ending:.

Wait for text confirms the screen is ready.

textWaiting for the Inquiry Screen
Wait for text on terminal session
  Text to wait for: Period Ending:
  Wait for text location: Screen

Enter yesterday's date (stored in the variable %YesterdayDate%).

textEntering the Search Date
Set text on terminal session
  Get field by: Label
  Label: Period Ending
  Text: %YesterdayDate%

Submit the inquiry.

textRunning the Report
Send key to terminal session
  Key to send: Transmit

The result screen now shows the summary. The label Gross Sales: sits on Row 10, Column 2. The value starts at Row 10, Column 20 and is 15 characters wide.

We use Get text on terminal session to capture the value.

textExtracting the Sales Total
Get text on terminal session
  Get text by: Position
  Row: 10
  Start column: 20
  End column: 35
  Retrieved text: => %DailyGrossSales%

The variable %DailyGrossSales% now contains the value. Your flow can append it to a CSV file, write it to a SharePoint list, or trigger a Power Platform notification.

Alternative Connection: Micro Focus Reflection

If your enterprise standard is Micro Focus Reflection instead of the IBM i Access Client Solutions (PC5250), the initial setup differs slightly.

  1. Enable the API: Open Reflection, go to Setup > Application Programmer Interface and ensure Enable API is checked.
  2. Configure the session: Use the following parameters in the Open terminal session action:
textMicro Focus Reflection Setup
Open terminal session
  Provider: Micro Focus Reflection
  Installation path: C:\Program Files (x86)\Micro Focus\Reflection
  Host type: IBM 5250
  Host address: %AS400_Host% (e.g., INVSYS.CONTOSO.COM)
  Port: 23
  Attach to running session: False

All subsequent Set text, Send key, and Wait for text actions behave identically regardless of which provider you use.

Common Pitfalls & How to Avoid Them

  • The Stale Screen Bug: Attempting to read or write before the screen updates is the most common failure. Fix: Always precede a read/write with Wait for text on terminal session. Avoid generic WAIT actions—they are fragile and environment-dependent.
  • Incorrect DLL Path: The ehlapi32.dll file resides in different folders depending on the PAD runtime (x86 vs x64) and the IBM i Access version. Fix: Browse to the exact file location on your automation machine instead of trusting a hardcoded path.
  • Session Name Mismatch: The session name in Open terminal session must exactly match the window title of the running emulator. Fix: Use the Terminal action group's Get active terminal sessions action to dynamically retrieve the correct name.
  • Subfile Navigation: When dealing with lists of records (subfiles), you must detect the end of the list—often indicated by "More..." or a blank line—and send RollDown (Page Down) to scroll. Fix: Use a Loop condition that checks for the "More..." text before scrolling.
  • Hardcoded Credentials: Password fields in terminal sessions accept plain text, but exposing them in plain text inside a flow is a security risk. Fix: Store secrets in Azure Key Vault and retrieve them with the Get password from Azure Key Vault action.

Advanced Considerations

  • Error Handling: Wrap your main logic in a Try Catch block. If the AS400 session drops mid-flow, the Catch block can close the terminal session and restart the application.
  • Session Cleanup: Always close the terminal session in the Finally block of your flow using Close terminal session. Unclosed sessions can pile up on the server, consuming licenses and causing instability.
  • Multi-Threading: If you need to run multiple flows in parallel, each instance must use a unique session name to avoid resource contention.

Final Recommendation

Power Automate Desktop’s terminal emulation actions are a mature, reliable way to integrate legacy IBM iSeries systems into modern Power Platform workflows. The pattern is straightforward:

Wait for Text → Set Text → Send Key → Wait for Text → Get Text

While the initial row/column tuning requires careful observation of the green screen, the payoff is immediate. A ten-minute bot can save your team hours of manual data entry every day, turning your "green screen" into a fully automated citizen of your digital ecosystem.

Start with a simple lookup, master the wait-and-type rhythm, and expand to complex data extraction or multi-step order entry. Your legacy mainframe doesn't have to be a silo—with PAD, it can be a seamless part of your Power Platform strategy.

References