I need to automate interaction with an IBM z/OS "green screen" application. The obvious answers include trying Net::Telnet or scripting with s3270. But the catch is that I can't install anything in this environment. Nothing like Hummingbird or IBM Terminal Emulator are available. I have only what's in Perl 5.8.4 and what I can code up myself.

I've tried to read the relevant RFC and the source code to s3270, but I really can't even begin to figure how to code a client.

If I connect to the IBM server with telnet I do get some text. I see the initial login screen, but I can't interact with it. As soon as I hit enter things go all garbled.

So I tried to reverse engineer the protocol by coding a little proxy (no tcpdump or netcat available). I had a script open an IO::Socket::INET to the IBM server and another listen for a local connection. It then IO::Selects between the two and writes back and forth and dumps everything to the screen. When I telnet/tn3270 to the local proxy, there is no output to the screen at all and the client says it's waiting to connect. Nothing fails, both sockets just sit there doing nothing.

Any advice on how to proceed would be much appreciated, because I am stuck. I guess my next step is to study the source of Net::Telnet and try doing some of what that does.


In reply to automate / screenscrape tn3270 session by kingkongrevenge

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.