views:

84

answers:

3

I was wondering if anyone had experience retrieving data with the 3270 protocol. My understanding so far is:

Connection

I need to connect to an SNA server using telnet, issue a command and then some data will be returned. I'm not sure how this connection is made since I've read that a standard telnet connection won't work. I've also read that IBM have a library to help but not got as far as finding out any more about it.

Parsing

I had assumed that the data being returned would be a string of 1920 characters since the 3278 screen was 80x24 chars. I would simply need to parse these chars into the appropriate fields. The more I read about the 3270 protcol the less this seems to be the case - I read in the documentation provided with a trial of the Jagacy 3270 Java library that attributes were marked in the protocol with the char 'A' before the attribute and my understanding is that there are more chars denoting other factors such as whether fields are editable.

I'm reasonably sure my thinking has been too simplistic. Take an example like a screen containing a list of items - pressing a special key on one of the 24 visible rows drills down into more detailed information regarding that row.

Also it's been suggested to me that print commands can be issued. This has some positive implications - if the format of the string returned is not 1920 since it contains these characters such as 'A' denoting how users interact with the terminal, printing would eradicate these. Also it would stop having to page through lots of data. The flip side is I wouldn't know how to retrieve the data from the print command back to Java.

So..

I currently don't have access to the SNA server but have some screen shots of what the terminal will look like once I get a connection and was therefore going to start work on parsing. With so many assumptions and not a lot of idea on what the data will look like I feel really stumped. Does anyone have any knowledge of these systems that might help me back on track?

+1  A: 

You might find this question interesting.

http://stackoverflow.com/questions/2377553/implement-3270-protocol-in-java

Thorbjørn Ravn Andersen
I had seen this and dismissed freehost3270 as a java library since it was noted it had been 'abandoned' however I've spent the last couple of hours reading through the code and it's client module is very good.
James
+3  A: 

You've picked a ripper of a problem there. 3270 is a very complex protocol indeed. I wouldn't bother about trying to implement it, it's a fool's errand, and I'm speaking from painful personal experience. Try to find a TN3270 (Telnet 3270) client API.

EJP
Indeed, find a script-able TN3270 client. Implementing TN3270 yourself (including the complex "3270 Data Stream") is a task worthy of renown on its own, let alone as part of a screen-automation project. Like EJP, I've done exactly that, and it was fun and profitable, but it's not a weekend project.
Ross Patterson
+1  A: 

This might not specifically answer your question, but...

If you are using Rational Developer for z/OS, your java code should be able to use the integrated HATS product to deal with the 3270 stream. It might not fit your project, but I thought I would mention it if all you are trying to do is some simple screen scraping, it makes things very easy.

Joe Zitzelberger