Link to home
Start Free TrialLog in
Avatar of chandukb
chandukb

asked on

Call AS/400 CL Program from Visual Basic

How do I call a CL Program in the AS400 Machine from my VB Application?

I use ADO and ODBC to connect to AS400 and the connection object is: gJDEConnection

The program I need to call:
'DBTEST is the Library and J57COMTEST is the CL program.

Can anyone give me sample code?, I tried different variations of CALL QSYS. blah blah blah, but doesn't work, so I am looking for code samples.

And if I am able to call a CL Program, what happens if an error occurs in the CL Program, Do I get the error back to my VB APP?


Thanks
Chandu

ASKER CERTIFIED SOLUTION
Avatar of iboutchkine
iboutchkine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nazdor
Nazdor

Just as an extra, you could use a message queue to send/receive information between the VB prog and the CL prog - but it's not exactly an easy task...
Avatar of chandukb

ASKER

I am calling the CL program using the command object, but
my whole application freezes and task manager shows my app
Not Responding state.  If there is any error in CL program,
my vb app should get an error right?  Why is it Not Responding state?

Any ideas/suggestions?

Chandu
Nazdor,

Any Links for message queue between vb and cl programs.

Thanks
Chandu
If you have an error in CL, you will not get an error in VB. I tried it many times. Check your CL
Your VB app will be completely 'frozen' until the 400 returns.  This will look like "Not Responding", but if the 400 does finish, then it will start responding again.  This has to do with the badly-written ODBC drivers being used by the command object.  If the 400 never returns because it's stuck with an error, then your VB program will probably not start either.

You could try different ODBC drivers, eg from HiT or maybe change the commandtimeout value.

You wont ever get a 'reply' from the CL as there's no way for the VB prog to receive the return code of the program.



I'll have a look for those links and let you know later - but there should be some on the search part of the IBM site.
I still can't figureout how to get the error from CL program, but your comments gave good direction.

Thanks
Chandu