- Rust 99.2%
- Shell 0.4%
- Python 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| app | ||
| docs | ||
| scripts | ||
| tn5250 | ||
| .gitignore | ||
| AGENTS.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| README.md | ||
5150
A native macOS 5250 emulator for IBM i, written in Rust.
It was built to replace IBM i Access Client Solutions (ACS) on the Mac without Java: 5250 display emulation (TN5250E), printer session, spool management with PDF export, IFS files and remote commands.
The protocols are implemented from scratch based on public documentation: RFC 1205, RFC 2877 and RFC 4777 for 5250, and the open source code of JTOpen for the IBM i host servers. It contains no IBM code. 5150 is not an IBM product and is not affiliated with IBM; IBM i and Access Client Solutions are trademarks of IBM.
Requirements
- macOS 11 or later (Apple Silicon or Intel)
- Rust to build (2024 edition)
- A reachable IBM i system: telnet 23 or TLS 992 for 5250; for spool, IFS and remote commands, the host servers
(ports 8470-8476, or 9470-9476 over TLS, started with
STRHOSTSVR *ALL)
Build and run
git clone forgejo@git.yoshi.int:fra/5150.git
cd 5150
cargo run --release -p term5150
To build the app to put in Applications (dist/5150.app, ad-hoc signed):
scripts/bundle.sh
The app is not signed with an Apple Developer certificate: if it is copied to another Mac, open it the first time with right click > Open, or remove the quarantine attribute:
xattr -dr com.apple.quarantine /Applications/5150.app
Quick connect from the terminal: term5150 PROFILE_NAME or term5150 host[:port].
Features
5250 emulation
- Telnet TN5250E with TTYPE, EOR, BINARY, NEW-ENVIRON negotiation (DEVNAME, KBDTYPE, CODEPAGE, CHARSET)
- TLS: certificate verified with the macOS Keychain, or self-signed certificate remembered on first connection (SHA-256 pin)
- 24x80 (IBM-3179-2) and 27x132 (IBM-3477-FC) screens, Clear Unit Alternate
- Complete data stream: Write To Display with all orders (SOH, SBA, IC, MC, RA, EA, SF, TD, WEA), Read Input/MDT/Immediate, Read Screen, Save/Restore Screen, Roll, Write Error Code, 5250 query (WSF)
- Fields with FFW/FCW: bypass, monocase, alphabetic/numeric/digits only, signed numeric, right adjust with zero or blank fill, auto-enter, mandatory field exit, dup, non-display fields (passwords)
- 5250 keyboard: Field Exit, Field+, Field-, Dup, Erase EOF, Erase Input, Insert, Reset, Attn, SysReq, Help, Clear, Print, PF1-PF24, Roll, New Line, type-ahead while the system is busy
- OIA: X SYSTEM, X II with error code, MW, INS, type-ahead, cursor position, TLS
- EBCDIC code pages: 37, 273, 277, 278, 280 (Italy), 284, 285, 297, 500, 871 and the euro variants 1140-1149
- TN5250E printer session (IBM-3812-1): receives SCS and saves each print job as PDF
Spool (Tools > Spooled Files…, Shift+Cmd+S, or the Spool button in the profile list)
- Connects to the IBM i host servers (sign-on and network print server, ports 8474/9474) with the password encrypted like IBM i Access: DES for QPWDLVL 0/1, SHA-1 for 2/3, SHA-512/PBKDF2 for 4
- Spooled file list filterable by user, queue, user data and status
- Open as PDF (double click), download several spooled files as PDF into a folder, page by page text preview, hold, release, delete
- *SCS spooled files converted to PDF locally; *USERASCII files that are already PDF saved as they are; AFPDS/IPDS converted to PDF by the server with Host Print Transform (QCTXPDF, requires IBM Transform Services), otherwise saved raw
IFS files (Tools > IFS Files…, Shift+Cmd+I)
- Browse Integrated File System folders (file server, ports 8473/9473), sort by column
- Download (also multiple files and folders, recursively), upload files with overwrite confirmation, open with double click, new folder, rename, delete
Remote commands (Tools > Remote Commands…, Shift+Cmd+E)
- Runs CL commands through the remote command server (ports 8475/9475), showing the returned messages (ID, severity, text, second level help)
- Command history with up/down arrow, copy the log
Spool, IFS and remote commands can also be opened from the buttons next to each profile in Sessions.
Interface
- Multiple tabbed sessions, profile management, import of ACS/HOD
.hodand PCOMM.wssession files - Screen that scales with the window, themes (classic, ACS, amber, light), block/underline/bar cursor, ruler, column separators
- Clickable hotspots (
F3=Exit,More...), mouse wheel as Page Up/Down, click to position the cursor - Rectangular selection, copy, paste into fields (also across multiple lines), text search on the screen
- Function keypad (PF1-24 and special keys), configurable keyboard mapping
- Recordable and editable macros, with
[pause ms],[waitfor TEXT],[user],[password](password in the Keychain), automatic macro at session start - Screen history with PDF export, print screen (PDF in Preview), save as text or PNG
- Automatic reconnection and keep-alive
Keyboard
Two layouts, chosen in Tools > Preferences or in Tools > Keyboard Mapping. Every key can then be remapped on top of the chosen layout.
Classic 5250 (default), like Client Access / PC5250 on a PC keyboard:
| Key | 5250 |
|---|---|
| Right Control (pressed alone) | Enter |
| Right Cmd (pressed alone), Control+Return, Option+Return | Enter (for laptops without a right Control) |
| Keypad Enter | Enter |
| Main Return | Field Exit |
| Shift+Return | New Line |
| Left Control (pressed alone), Control+Esc, Control+R | Reset |
| Esc | Attn |
| Shift+Esc | SysReq |
| Keypad + and - | Field+ / Field- |
Modern Mac: Return = Enter, Control+Return / Option+Return = Field Exit, Esc or Control alone = Reset, Option+Esc = Attn, Shift+Esc = SysReq; the keypad types its characters.
Common to both layouts:
| Key | 5250 |
|---|---|
| Tab / Shift+Tab | next / previous field |
| F1-F12, Shift+F1-F12 | PF1-PF12, PF13-PF24 |
| Control+1..0, Control+-, Control+= (with Shift: +12) | PF1-PF12 (PF13-PF24) |
| Page Up / Page Down | Roll Down / Roll Up |
| End, Home | end of field, home position |
| Option+ + / Option+ - | Field+ / Field- |
| Cmd+Backspace, Option+End | Erase EOF |
| Cmd+Shift+Backspace | Erase Input |
| Control+I | Insert |
| Control+H / Option+F1, Control+D, Control+L, Control+P | Help, Dup, Clear, Print |
| Control+A, Control+S | Attn, SysReq |
| Cmd+C / Cmd+V / Cmd+A | copy / paste / select all |
| Cmd+P, Cmd+F, Cmd+K, Cmd+R | print screen, find, keypad, ruler |
| Cmd+Shift+R | record macro |
Left/right Control, right Cmd and the keypad keys are read directly from macOS (app event monitor, no accessibility permissions needed).
Configuration
~/Library/Application Support/it.fippoliti.5150/config.toml (profiles, preferences, mapping, macros).
Passwords are stored in the Keychain (service "5150 tn5250").
Structure
tn5250/: protocol library (telnet, data stream, screen model, keyboard, TCP/TLS session, SCS printer). No graphics dependencies.app/: egui/eframe application.docs/: images for this README.tn5250/examples/dump.rs,fields.rs,spool.rs: command line clients to exercise the protocol (spool probe HOSTonly exchanges the seeds, without signing on).
Not yet available
Data transfer and Run SQL (database server), automatic 5250 sign-on with RFC 4777 encrypted password, DBCS, advanced 5250 graphical constructs (GUI windows and buttons).
Development
cargo test --workspace
cargo clippy --workspace
cargo run -p tn5250 --example dump -- pub400.com
pub400.com is a public IBM i, handy for testing the connection and the sign-on screen.
