|
|
Question : Is it possible to automatically copy data from AS/400 to Excel (or Lotus 1-2-3) without external apps?
|
|
|
|
Hello
I'm new to AS/400. In my new job in a big company my boss asked me to do some repetitive manual data transfers between AS/400 and Excel (or Lotus 1-2-3). Being an IT technician I'm sure that this task can be automatized but I'm a limited Windows user with no permissions to install new apps on the PC so I'm limited to do it with the internal capabilities of the AS/400 app and Excel (or Lotus 1-2-3), that I still don't know.
To have a starting point to learn, I would like a solution (this is what I ask with this question) that performs this simple task: in the current AS/400 screen, copy the last number (with two decimals) of the current line and paste it in the first column of a new line of a new Excel (or Lotus 1-2-3) sheet, then add the word "foobar" in the cell immediately below.
___
Some info that you may need to know:
- We call our AS/400 app "3270". In Help-about I see this: "Personal Communications WorkStation Program Version 5.0 for Windows 95, Windows 98, Windows NT and Windows 2000 Licensed Material - Property of IBM Copyright IBM Corp. 1989, 2000. [...]"
- Excel version is 2000
- Lotus 1-2-3 version is 9.7 (© 2000,2001)
- language of all the apps is english
|
|
|
|
Answer : Is it possible to automatically copy data from AS/400 to Excel (or Lotus 1-2-3) without external apps?
|
|
Well, if you are a VB (for example) scripting pro, then this isn't too bad. If not, then it is a fairly difficult task, because there is a good deal of learning curve before you get up to the useful part. An old version of PCOMMSounds like you are using an old version (ten years old!) of IBM Personal Communications (PCOMM), V5.0. V5.0 is long out of support, so you're liable to have trouble getting much specific help with it. I have worked with PCOMM a few times over the years, and it has always supported a variety of programming, macro, and scripting interfaces.
If V5.0 supports HACL automation objects, then you are probably in good shape.
The current PCOMM version is 6.0.1.http://www-01.ibm.com/software/network/pcomm/ PCOMM 3270 vs PCOMM 5250Normally, you would use IBM PCOMM 3270 (3270 is a type of mainframe dumb terminal) for connecting to IBM mainframes, and IBM PCOMM 5250 (5250 is a type of AS/400 dumb terminal) for connecting to AS/400s. Also, there is a version of PCOMM that includes both products: 3270 emulation and 5250 emulation. To make things even more confusing, you CAN use PCOMM 3270 to connect to the AS/400. I only mention it so that you can find the appropriate manual. Start with the 5250 manuals, and if the functions don't match very well, look at the 3270 manuals instead. PCOMM Documentation
This link current has documentation going back to V5.6:
http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topic=/com.ibm.pcomm.doc/Documentation.htm
Your software probably shipped with paper or electronic manuals. Find the installation CD, or look in your installation directory on your workstation, and you light get lucky. Also, there are some optional (very useful) programming samples that can be installed - it just depends on the options that the person that installed the software on your system selected. If you have access to installation media, you can copy of install the documentation and programming samples yourself.
Once you find the closest version of the documentation to your software, read up on Macros and Scripting in the User's Guide or User's Reference for your version (or the oldest version that you can find documentation for), the read the HACL Guide. Scripting with HACL (Host Access Class Library)
Every version of PCOMM that I can recall over the years includes Macro and Scripting functions that can be harnessed to do just what you want to do. Macros are usually limited to controlling functions within the PCOMM program only. Scripts, on the other hand, are written in VBScript, and can inter-operate with other programs, including Excel.
HACL Automation Objects are a collection of classes that can be called from VB, VBA, or VBScript (and other scripting environments) to control the emulator and to send and receive data to the emulator window.
An easy way to get started with creating a script is to record a VBScript macro in PCOMM that handles the AS/400 navigation portions of your tasks. For example, if you have to:
Log on Access a series of menu options Press F4 Enter your employee number Then select some data at a particular place on the screen, and Copy it to the clipboard
You can record a macro that does all of that (it will automatically code a series of HACL calls for you), and then take that macro and use it as a starting point for your script.
Record and save the macro as a VBScript macro, and then open it up in an editor (Notepad will do, but Excel has a very nice built in VBA editor that I like) and add code to open or switch to Excel, open a particular spreadsheet, navigate around your spreadsheet, and paste the information in to the spreadsheet.
You can even use Excel's built-in macro recording ability, just like you did with PCOMM to generate most of the Excel part of the script for you. Open up Excel's great buit-in Help and look up "Macro". You'll find articles that explain hoe macros work, how to record a macro, how to edit a macro, now to put a macro button on the toolbar, and more.
If you are familiar with writing these types of scripts, then this is a "medium" technical difficulty task, since recording the macro codes most of the "hard part" for you. If you've never don't this type of scripting, then you have some significant learning curve ahead of you.
Here's a thread where we discussed HACL scripts in the past. There is a little sample code there:
http://www.experts-exchange.com/Programming/System/AS_-_400/Q_24956712.html?sfQueryTermInfo=1+gari+hacl+pro
You can find all of the HACL (V5.9) objects documented here, with nice code fragments that you can cut and paste right into your script:
http://publib.boulder.ibm.com/infocenter/pcomhelp/v5r9/index.jsp?topic=/com.ibm.pcomm.doc/books/html/host_access02.htm
Is scripting the right tool?
Often, scripting like this isn't the easiest way to capture AS/5400 date for use in PC applications.
Most of the time, the data that you want to get into your spreadsheet already exists in a database table on the AS/400.
If you have access to the AS/400 development team, you may find that they can help you locate the data you need, and formulate database queries to extract the needed data. There a numerous tools, including the PCOMM File Transfer function, that would enable you to directly query the AS/400 database for specific data and download it into a format that can easily be imported into Excel.
Have fun, and feel free to post back if you need help with your script. I can't write it for you, but I can help you if you get stuck.
- Gary Patterson
|
|
|
|