pmattes / x3270

Family of IBM 3270 emulators
46 stars 18 forks source link

Question: Some PF keys not mapping on wc3270 #48

Open robinmatz opened 1 year ago

robinmatz commented 1 year ago

Hi there!

This is a question coming from Altran-PT-GDC/Robot-Framework-Mainframe-3270-Library#69

The project is a wrapper for py3270 for robotframework.

The user was receiving the error message "Function key not allowed" when sending PF(3) to wc3270 when launched from script. However, when launching wc3270 manually, the issue did not occur.

In the analysis, we found out that it is the -xrm wc3270.model:2 parameter that causes the issue.

Can you explain why this is the case?

pmattes commented 1 year ago

The main difference that the model parameter makes is the size of the emulated 3270 screen. wc3270 and s3270 do not use the model number to decide which function keys work, and "Function key not allowed" is not a wc3270/s3270 error message in any case.

My guess is that your application is behaving differently depending on the screen size, and is getting itself into a bad state when it is not running on the screen size it expects.

Capturing some wc3270/s3270 traces in the 'good' and 'bad' cases would probably shed some light on your issue.

robinmatz commented 1 year ago

I was able to reproduce this behavior on the publicly available pub400.com host. Here is what I did:

  1. Start wc3270
  2. connect pub400.com
  3. Enter credentials
  4. send PF(4) and PF(3) to get into and exit information
  5. disconnect

I did this with both model 4 (default) and model 2. With model 4 the PF keys worked as expected, with model 2 they didn't. Please find both trace files attached. wc3270-model4.txt wc3270-model2.txt

pmattes commented 1 year ago

Interesting issue!

Here is the big difference: With a model 2, the host accepts that the terminal is a real 3270 and the session uses the 3270 data stream protocol (what is what wc3270 is intended for). With a model 4, the host is apparently unhappy with the protocol negotiation and leaves the session in TELNET NVT mode, where wc3270 is emulating an xterm (ANSI/VT100-like serial terminal).

What the AS/400 host really wants to talk to is an IBM 5250 terminal. The host has a 5250 translation layer for the TELNET session, and it looks like the PF key mappings are different between the 3270-to-5250 translations (used for model 2) and the VT100-to-5250 translations (used for model 4).

For a 3270, the following document applies: https://www.ibm.com/docs/en/i/7.2?topic=sessions-3270-keyboard-mapping-telnet-servers As you can see in that document, the 3270 PF4 key is actually the 5250 'Print' function, which the trace shows is how it was interpreted. If you want the 5250 F4 key, you need to press PA1, followed by PF4, on wc3270.

For a VT100 terminal, the mappings are direct: PF4 is interpreted as the 5250 F4 key. Of course, that means that the 5250 Print function is not available.

robinmatz commented 1 year ago

Hi Paul,

Thanks for the quick help! Since there is no to do for the x3270 project, I think this issue can be closed.

FWDQK commented 1 year ago

Hi Paul,

Thanks for the quick help! Since there is no to do for the x3270 project, I think this issue can be closed.

wc3270 trace for page down.zip Hi, Please find the attached trace for the details where I have tried to execute PF7 directly and with Execute command.