You say that the iSeries is on a private LAN. Why not just write a program using ODBC to access the data you are after? Or, create some stored procedures on the iSeries and use a web service over there. I wonder if the direction is coming from someone that does not realize those facilities are available on that machine, or alternatively you don't have the ability to sign on and create things there. If the goal is to run specific commands, you might consider an FTP script using "syscmd".

That said creating a screen scraper application really is all about knowing the 5250 data stream.

Try this for more understanding. I pulled it from V5R3 since you said "iSeries" guessing that the system might be a bit further back in OS than current.

Jim Oberholtzer
CEO/Chief Technical Architect
Agile Technology Architects, LLC

On 7/15/2010 5:47 PM, Richard Nolde wrote:
*This message was transferred with a trial version of CommuniGate(r) Pro*
TN5250 list members:

I've been tasked with writing an interface between an application that
runs on a remote iSeries host, accessible with TN5250 over a private
network, and our application that would query the iSeries in real time
without human interaction. My application will run on a Linux or AIX
box, and act like a broker between the local application and the remote
iSeries host application that contains the database we are querying.

I've been studying the current TN5250 source code to get a feel for what
I'm up against and clearly this is no simple task. Can anyone recommend
one or more books/online sources about how the TN5250 interface on
iSeries works. eg format fields, data types, etc. I can generate the
requests manually with TN5250 and get the desired results back as a
spool file with lp5250d, so my main objective is how to replace the
curses interface with one that reads from a file or other
non-interactive source. Eventually, I will provide a daemon that handles
requests from multiple clients over a socket interface and serializes
them for submission to the iSeries host, but that isn't necessary for now.

From what I've read and seen by playing with the remote application, I
will need to know the position, length, and data types for each field of
each screen that I wish to use, and Action or Function Key definitions
for each screen. Assuming I can build a map that identifies each
component of each screen, and the sequence of screens that will be
encountered, I would then load each field with the appropriate value and
call one of the TN5250 functions to send the data on the stream to the
remote host application. If the application screen produces output, I
may or may not chose to parse it directly if I can get everything I want
from the print spool that is returned via lp5250d. In the sample cases
that I have looked at, the screen output simulates bold printing by
issuing a carriage return and then resending the data for selected
fields a second time, as might have been done with ancient line printers
of yore. I can probably parse this out but it would be nice to be able
to disable this altogether. I'm currently not using a Host Print
Transform on the print spool output, only scs2ascii as there are no
graphics involved. The returned data is in a format that I should be
able to parse on my end as long as I know the parameters that were used
to generate the query and the screen from which the output is derived.

I note that the TN5250 application can be compiled without ncurses
support, but doing so produced an executable that will not interact with
the remote host. I assume that this is due to the field position
requirements of the remote application.

My initial approach is to build a profile of all the function calls in
the tn5250 interactive application and see which ones call functions
from the ncurses library. Once I understand how/where the screen
co-ordinates are being set/read, I may be able to write a function that
will read the appropriate values from my template files and the input
data stream.

Any ideas/suggestions and online documentation references would be
welcome. I have no access to the iSeries host except through the remote
application. My servers run Linux or AIX 5.3.

Richard Nolde

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].