Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Desperate!! Client Express Toolkit Problem 1

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
0
0
US
After trying to call API's from Visual Basic to call programs on the AS400 and then pass a parameter back,
I eventually settled for the Express Toolkit wizard option
of 'Link programs'.

I have added a couple of programs and the code generated in VB works fine - as long as I run it on my machine.
If I copy an executable version on to another users PC,
the commands are not executed and the Visual Basic program just hangs. Has anybody else encountered this and if so what did they do to solve it?




Dazed and confused
 
Hi Skittle,
I suggest you pose this question in a VB Forum on this very web site.
 
Managed to sort it late last night.

The CL procedure I was indeed being called from VB.
I stuck some SNDMSG points into the CL and tracked where it was hanging. It was in fact hanging on the AS400.
The job was running as QUSER instead of my account and so i was missing the MSGW.

Since the call is of course synchronus, the VB client end hung as well.



Dazed and confused
 
Hey, skittle

We have a process where we pass information from an AS/400 to a pc, perform a process then return to an AS/400 System/36 environment program. What actually happens is the System/36 RPGII program executes a clp program on the AS/400 (with passed parameters) which in turn executes a STRPCCMD passing parameters. This process works very slowly on older processors using V4R3M0 when we use SQL to move the information from the AS/400 to the pc. We're passing a very limited amount of information from the AS/400 to the pc and discovered we could pass a parameter from the AS/400 to the pc and accomplish everything that has to happen on the AS/400.

The problem we've encountered is in moving that information back to the AS/400. If we write a file on the AS/400 to imply success or failure on the part of the pc program, it takes 30 to 45 seconds each time. That's also about what it was taking when we used file transfers from the AS/400 to the pc. Once we changed to passing a parameter it was instantaneous, of course. I haven't been able to figure out how to pass the parameter from a VB6 program back to the AS/400 clp. What I really need help with is in receiving the parameter into the clp that originally called the vb program and sending it from the vb program.

Thanks in advance.
 
Well I'm no expert on this but let me check I understand what you are trying to achieve.

A program on the AS400 needs to call a VB program and receive a parameter from the VB program back into the AS400 CL?

If thats correct, I've never done it before. I've never run a VB program from the AS400 or used a STRPCCMD command.

Have you set up a VB program to call a CL program? It maybe that the definitions that you create doing that will
work in reverse as well. The only way I found to be practical was to install Client Access Express ToolKit
and selecting 'Link programs' from the Express Toolkit drop down menu option in VB. This method allowed two parameter passing.

Another option may be to send a message to a message queue
from your VB program with the parameter information and modify your CL program to loop round a get message procedure in CL until it arrives. A bit crummy but thats
the only way I can think of based on my humble experience to date.






Dazed and confused
 
Having just looked at the STRPCCMD for the first time, it looks to me as if the command is a shell command and cannot return parameters?

Am I correct in my assumption you are still using STRPCCMD to call your VB program with a parameter?


Dazed and confused
 
Yes, you are correct in your assumption that I'm still using STRPCCMD to call my VB program with a parameter. I'm not sure at all that I understand some of your information. First, where do I find the Client Access Express ToolKit? Is that on the Client Access CD? I would have to assume, based on what you've said up to this point, I could execute a different cl procedure that would update my file (the only purpose to the returned parameter) then return to my calling program and simply resume execution. That'd do me just fine! By the way, I assume from your response dated today, July 14th that you may very well be on the east coast. My name is Jim Seering and I'm in Charleston, West Virginia. Perhaps we could arrange a more direct approach to helping each other. I've been working on IBM midrange equipment for about 35 years, but have quite outdated skills. I'm still using RPGII and don't know very much about clp. That's a substantial hindrance. I've recently begun "dabbling" with VB, both VB6 & .net.

I really appreciate your response, by the way.

Jim
 
I'm a bit further away than that dude.
Nottingham, England :eek:)
I'm 36 so rather terrifyingly, you've been working on IBM stuff since I was 12 months old!!!!

I've been on AS400's for about 15 years and started working with VB6 last year. My skills I consider outdated so for the last two years I've been trying to upgrade them. Over the last couple of months I've worked on getting VB6 to work with AS400's but I'm no expert. I found it difficult because there are no books and few articles out there on how to do it. A book I found that is out of date but still a good start point is, 'Client/Server Programming With Visual Basic 5.0'. It uses windows API's. This was the way to do it BEFORE Client Access the Express Toolkit was available.

Client Express Toolkit is part of Client Access and is a sub-option ( one of those tick box options like you get when installing windows and you have the option for games,
dial up networking, internet explorer etc ). Once you have it installed, it appears in your VB project window to the right of 'run' and 'query' as a drop down menu.

I'm not certain it will help you do what you want but for calling AS400 programs from VB6, its the best way to do it.

If you want to swap direct emails I have no problem with that. I'm no expert at VB6/As400 but we may be able to give each other ideas.


With regard to your specific problem.....

You are working on the exact opposite problem to me.
I wrote a VB6 program to upload data on to the AS400 from a CSV file and call a CL procedure to manipulate it on the AS400. The CL procedure can return a variable to my VB program.

So with my limited knowledge.....

1) Your CL program can call your VB6 program as you have described.

2) At the end of you VB6 program, put a command in it
to set a value in a data area or file by calling
another AS400 CL program.

3) The next line on your 1st CL program after the call
to your VB program could read the data area to pick up
the returned parameter.

If the data area is blank, go into a loop with
a ( 5 second? ) pause until the data area has a value in
it. If it hasn't arrived after 10 minutes, exit
the program so you don't hang for ever.

This assumes there is only one user per call of the VB program of course. It sounds a poor solution to me but without further investigation I can't suggest any other method UNLESS you make the VB program the front end to 'pull' the data from the AS400 using ODBC ( carefully ),
process the data, and then 'push' it up again to the AS400 using ODBC ( again carefully ).










Dazed and confused
 
Very, very close. I've already tried using odbc & oledb. That path is too slow. We work with county agencies here in the state of West Virginia. As you might suspect some of their budgets are quite limited. The AS/400 I'm trying to run this on is about 8 or 10 years old and is running R4M3V01 of the operating system. When we run the file transfer on this system it takes about a minute and a half to transfer the record.. 1 Way! Then we have to transfer it back. If I perform the same operation on a current system using R5M2V0 the same process runs in about 3 seconds. Even with the new processors & operating systems that's a pretty slow process considering it's an online operation. Consequently, the 30 to 45 second slowdown is totally unworkable

That's why we decided to try simply passing a parameter from the AS/400 to the VB program. That happens faster (well almost) than you can blink your eyes. Soooo, we wanted to repeat that process passing information back to the AS/400. It won't matter if we execute a separate cl program from the VB program. That would be a completely acceptable method of updating the file on the AS/400 and I would assume it would happen before control could return to the original program.

I will look for the toolkit, install it and toy around with it a bit.

Now for the bad news! I've actually been programming for more like 38 years. That would mean you were simply a twinkle in someones eye when I started programming....LOL That in no way implies that I necessarily have more knowledge than you. Perhaps a few more tricks in several areas, but, the reality is things evolve so fast that an "old timer" can't come close to keeping up with it.

Hope you have a good evening.

Jim
 
Hey guys,

I have experienced in what you are doing (AS400/VB & vice versa) and to tell you the truth I have to scrap it because AS400 is not really a VB friendly environment. Have you guys considered FTP with perl combination(shell) or FTP wih SQR/SQL combination?. I have rewritten my own utilities using SQR/ftp combination and never look back.

We have 4 AS400 V5.2(for each hospital) and each of them communicate to different platforms (sun , AIX,tandem etc).
These systems even communicate to the outside world with just
the same concept. I use SQR because it can be loaded both on
any system including as400 and to any PC (client/server method)using ODBC or native Oracle connectivity and UDB. What impressed me with SQR is that in one program alone you can
open different DB types and platforms at the same time. It means one program can let your machines talk to each other.
You don't even need FTP to send data. I just use it because it is our standard(policy).

You may also have to consider using socket or API programing which I find more easier to implement and analize all error messages between systems. I'v been slowly migrating some of my utilities to using socket programming.

I have been with IBM(all machines) since S/360 and since
AS400 was called S/3, S/34. S/36 then S/38. I can also
program in Fortran, cobol, RPG1-4,basic,assembler,cc+,perl,
vb,java,javascript,unix,sqr, and may more.
 
wvjim,

the toolkit is essential.
Another option might be data queues although I know nothing about how they work with VB. Its another toolkit option.
The help is quite good in the toolkit.

One thing I do with regards to ODBC is to use a middle file on the AS400. Its empty and is populated by the ODBC link and then a procedure on the AS400 copies the data to the final destination file before clearing the middle file down. That reduces the connection opening time of each VB ODBC link simply because there is no data in the middle file.

Dazed and confused
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top