Running an AS/400 CL program via ODBC

Aaron Fransen aaronf at nospam.telusplanet.net
Tue Jun 5 15:28:30 CEST 2001


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