用java解析IBM 3270数据
我想知道是否有人有使用 3270 协议检索数据的经验。到目前为止我的理解是:
连接
我需要使用telnet 连接到SNA 服务器,发出命令,然后将返回一些数据。我不确定这个连接是如何建立的,因为我读到标准的 telnet 连接不起作用。我还了解到 IBM 有一个库可以提供帮助,但没有找到更多相关信息。
解析
我假设返回的数据将是一个 1920 个字符的字符串,因为 3278 屏幕是 80x24 个字符。我只需要将这些字符解析到适当的字段中。我对 3270 协议了解得越多,这种情况似乎就越少 - 我阅读了 试用版提供的文档Jagacy 3270 Java 库 认为属性在协议中用属性前的字符“A”进行标记,我的理解是有更多的字符表示其他因素,例如字段是否可编辑。
我确信我的想法过于简单化了。以包含项目列表的屏幕为例 - 在 24 个可见行之一上按特殊键可深入了解有关该行的更详细信息。
另外还建议我可以发出打印命令。这有一些积极的影响 - 如果返回的字符串的格式不是 1920,因为它包含这些字符,例如表示用户如何与终端交互的“A”,则打印将消除这些字符。它还将不再需要翻阅大量数据。另一方面是我不知道如何将打印命令中的数据检索回 Java。
所以..
我目前无法访问SNA 服务器,但有一些屏幕截图,显示一旦我获得连接,终端将是什么样子,因此将开始解析工作。有了这么多的假设,但对数据的样子却没有太多的想法,我感到真的很困惑。有谁对这些系统有任何了解,可以帮助我重回正轨吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你已经选择了一个问题的解决者。 3270确实是一个非常复杂的协议。我不会费心去尝试实现它,这是一个愚蠢的差事,而且我是从痛苦的个人经历中说出来的。尝试查找 TN3270 (Telnet 3270) 客户端 API。
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.
这可能不会具体回答您的问题,但是...
如果您使用 Rational Developer for z/OS,您的 java 代码应该能够使用集成的 HATS 产品来处理 3270 流。它可能不适合您的项目,但我想如果您想做的只是一些简单的屏幕抓取,我想我会提到它,它使事情变得非常简单。
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.