Running an AS/400 CL program via ODBC

Aaron Fransen aaronf at nospam.telusplanet.net
Tue Jun 5 23:45:53 EDT 2001


Further, I kinda got it working...but without parameters. If I embed the
values of the various strings in the actual CALL, it works; this is a pain
in the butt, but it'll do the trick to a point.

The other problem is where the callproc procedure would really be handy,
which isn't implemented in the Win32 stuff from ActiveState. I actually need
to (a) call a program, (b) give it parameters, and be able to (c) read back
two of the parameters, which the AS/400 program would have modified.

Thoughts?

"Aaron Fransen" <aaronf at nospam.telusplanet.net> wrote in message
news:285T6.2595$Jg4.368004 at news1.telusplanet.net...
> The user ID is authorized for the various objects on the AS/400, but
> interestingly I get a "Syntax Error" when using the LIB/PGM nomenclature.
>
> And most surprisingly, there are NO entries in the joblog on the AS/400!
In
> fact event the QZDASOINIT job only shows that it's servicing a request,
but
> not the details of the request. Obviously I've got some logging option
> turned off so maybe I'll check into that in the meantime.
>
> I suspect it has to do with the cursor type, perhaps? I remember having a
> buggar of a time figuring it out in VB; actually running a program seemed
to
> be so dramatically different in terms of VB's required syntax than simply
> running an SQL query that it makes me think that there's something more
> complicated I have to do in Python.
>
> "Simon Brunning" <SBrunning at trisystems.co.uk> wrote in message
> news:mailman.991730178.25094.python-list at python.org...
> > > From: Aaron Fransen [SMTP:aaronf at nospam.telusplanet.net]
> > > I have a problem executing an AS/400 CL program from the SQL/ODBC
> > > interface
> > > in Python. I know the interface on the AS/400 works because I actually
> > > wrote
> > > the code to do it originally in VB, which has been live on our web
site
> > > for
> > > months. I'm getting sick of the Really Big Visual Basic Corporation
> > > though,
> > > and am in the process of converting the site to Python, which seemed
to
> me
> > > to be about the best/easiest/really cool tools out there.
> > >
> > > I can run any SQL query via the ODBC 2 interface (Python 2.1) using
the
> > > following code:
> > >
> > > dbc=odbc.odbc("datasourcename/as400username/password")
> > > cursor=dbc.cursor()
> > > cursor.execute("Select * from MYTABLE")
> > > result=cursor.fetchall()
> > >
> > > Works perfectly. However, if I try something like this:
> > >
> > > cursor.execute("{{Call
> > > LIB.PROGNAME(?,?,?,?,?,?)}}",['PARM1','TWO','THREE','1','',''])
> > >
> > > it bakes with "SQL0204 - PROGNAME in LIB type *N not found. in EXEC".
> > >
> > > Thoughts?
> >
> > Is the user ID that you are using authorised to the program?
> >
> > Are there any exit programs on your system which could be blocking
access?
> >
> > Have you tried the LIB/PGM naming convention?
> >
> > Anything else in the job log?
> >
> > Cheers,
> > Simon Brunning
> > TriSystems Ltd.
> > sbrunning at trisystems.co.uk
> >
> >
> >
> >
> > -----------------------------------------------------------------------
> > The information in this email is confidential and may be legally
> privileged.
> > It is intended solely for the addressee. Access to this email by anyone
> else
> > is unauthorised. If you are not the intended recipient, any disclosure,
> > copying, distribution, or any action taken or omitted to be taken in
> > reliance on it, is prohibited and may be unlawful. TriSystems Ltd.
cannot
> > accept liability for statements made which are clearly the senders own.
> >
>
>





More information about the Python-list mailing list