Pulling date from AS400 screens

brgoss

New member
Joined
May 3, 2012
Messages
3
Programming Experience
Beginner
Hello everyone,
I'm still a beginner programmer with VB.NET. I've had a couple of semesters using it, so I know the basics. I've got a project that I'm trying to work on for my job that is slightly a bit beyond my knowledge of how to do. We're running an old AS400 system and my boss in my center wants me to develop a better premium calculator for our phone reps. The problem is that the IT department won't share out anything even as read only. So I have no idea how the data is stored on our systems. However, I have an idea that I might be able to do, but not quite sure which is why I'm here. I've got the code for a macro that is using VBA inside the program to pull information and then send it to a work document. It's not pulling from the database though, instead it runs through and uses the coordinates on the screen to retrieve streams of characters and input in strings and key inputs to navigate the screens to continue to retrieve the info. So what I'm wanting to do, if possible, is develop a program through .NET that will open the program, navigate the screens, pull the info from the streams into variables, and then compute.

So, as the company runs now, the AS400 is the backbone, but we have a php interface developed through Jacada that everyone uses to manage accounts. So that means for my program, I'll have to actually open the old AS400 interface we used to use. If I can get the program open, and know how to navigate, input info and retrieve info, the rest is cake. I've tried searching around, but all the forum posts were all discussing people pulling the info off the tables. That unfortunately is not an option for me. I know this might be a bit much for me to have bitten off, but I'd like to have some work experience I can use along with my degree. Currently, I'm basically help desk for customer service, but not for IT. My office/site is also closing down in a year, so any experience I can get, well I'm trying to get. Anyway, apologies for a bit of rambling. If anyone has any idea, or links to any reference material, tutorials or such that would help me on this project, I would greatly appreciate it.
 
Wow that is some outdated antiquated system... Last I remember working on AS/400 they had a BASIC interpreter built in which you could use to store procedures to retrieve whatever data you are after. But that was 10 years ago and it was antiquated then.

The best solution would probably to ask the IT department to set you up with a secured SSH connection to the AS/400 and issue your commands remotely through there to retrieve the data you need.

Here's a starting point for them: OpenSSH on AS400 - some hints - n0r1sk software solutions
 
I appreciate the response and the suggestion. Unfortunately, I don't think they'd allow that. My company's an insurance company that is a bit behind when it comes to technology. Thus the AS400 still being our backbone system. So when someone calls us and makes a change to their policy, we need to give them a quote and then advise them of what their next bill will be. The IT department built a calculator that's for all intents and purposes half ***ed. So my manager asked if I could make one that functions better and to also include in other policies that are on the same billing account and include that in the billing calculator. As it is, our service reps have to manually calculate the next month's installment for all policies on the account and add to the current billing calculator amount, which is only for one policy and only if the premium is an increase. IT is telling us that it's too hard to include the other policies and to calculate. I know it's not, and the logic isn't a problem. So my project is two fold. To be able to distribute it to the service reps to help save time on their phone calls, but also to show IT that it can be done so they can take the logic and incorporate it into a better calculator that's built in. So as it's possibly being distributed to hundreds of other users, the SSH isn't an option. I need to be able to log into the AS400 client side program, and scrape the information off the screens. It'd be alot simpler if I could get access to the code for the existing billing calculator and I could just modify that code to do what's needed, but they won't even let me see the code, let alone modify it. So I'm stuck in my current debacle.
 
Who has higher authority here, your boss or the IT department? Pull some strings, get someone to lean on the IT guys to give you access to what you need.

"Boss I can't do what you ask of me because the idiots down at IT are being douchebags."
 
Unfortunately, IT is at Columbus in corporate and I'm at a satelite office. So while my manager is the highest boss here, he's not high up enough to lean on IT. I'll definitely ask him to at least get the code for the existing calculator, but I won't get my hopes up. IT's really old fashioned and very closed off when it comes to anything outside of their department.
 
I take IT departments side on this. Nothing worse than users developing. Who ends up supporting it after you leave? who quality checks your dev work?

If the system is that bad, the manager should be pushing for a better official release, with your input of need be.

Sent from my XT910 using Tapatalk 2
 
It sounds like you are trying to break the camel's back with the proverbial straw.

AS/400 systems are also known as iSeries, System i or IBM i, due to numerous re-branding.

IBM have their own tools (known amongst other things as Client Access) to connect to the AS/400, but there are other (less popular) third party tools available. If you want to use the AS/400 database, you really should pursue access to the tables. The way to go about this is to use the IBM iSeries DB2 .NET connector, which is an optional installable component of the Client Access product. You wont feel lonely if you have worked with MSSQL, as the data connector's methods and the base AS400 system SQL are very similar. There are things of course that are subject to the architecture, such as connection strings, addressing objects on the system and commitment control which are different. Most AS/400 manuals are freely available. Look for the PDF SQL manuals by Googling:
  • System i, DB2 Universal Database for iSeries SQL programming.
  • System i, DB2 for i5OS SQL Reference.
  • System i, Database SQL Message ans codes.
As well as having a .NET DB2 connector, Client Access also has a 5250 emulator; a "green-screen" style terminal emulator, which is commonly used. Using the 5250 emulator, macros can be recorded and subsequently played back to assist with commonly used tasks / keystrokes. When a macro is recorded, a VB script is created (by the 5250 emulator) which can then be used to "play" the sequence back. These macro files can be created from scratch, or the ones created by recording a macro via the emulator can be modified. The macros created by recording from the emulator are fairly basic record and play operations, however, by editing them, very sophisticated macros can be built to do all manner of things including scraping data from the screen.

Here is an example Client Access macro to do something when the text "MYPROGRAM1" is in line 1, position 2 for 10 characters, on the screen...
VB.NET:
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT

autECLSession.SetConnectionByName(ThisSessionName)

If autECLSession.autECLPS.GetText(1 , 2, 10)="MYPROGRAM1" then
    Rem  Here do whatever you need to do when the text "MYPROGRAM1" is in position 1, 2, 10.
End if

You could of course grab whatever data is on the screen and call an external program using WScript.Shell. You could bind such a macro to the enter key in the 5250 emulator, and before exiting the macro, call the enter key's base function in order to intercept screen calls.

More information is available on Host Access Class Library Automation Objects here: Help - Personal Communications

To my knowledge, the only thing with using this method is that you need to run the macros from the 5250 emulator. Or more accurately, the macros are not stand alone entities that can be run on their own without the emulator. That said, you will need a Client Access 5250 emulator session running, and a macro bound to it in order to accomplish what you need to do.

Using 5250 macros is an extremely obscure way of achieving what you want to do, and I certainly do not recommend it. It can be done at a push, but your solution will ultimately be an ugly one. Go for the tables.

I hope this has been helpful.

Kind regards.
 
Back
Top