I am looking for some good sites to learn about programming SQL on
the AS/400. I have the pdf versions of the manuals but what I'm
looking for are examples of good SQL code and how people are using it.
One thing I would like to be able to do is to convert queries that
are created with the Query tool to queries that can be run in Query
Manager. Also I have a bunch of queries that we use both types of
queries to come up with a final file and I'd like to be able to
combine them into one clean process using just the Query Manager.
Thanks,
Cole
"Cole" <cole...@yahoo.com> wrote in message
news:38a074e8.02101...@posting.google.com...
You'll get source that can be "compiled" with the CRTQMQRY
command and the resultant object run with the STRQMQRY command.
Be aware, however, that it doesn't do an adequate job of type 2
or type 3 queries. You'll need to tweak these your self using
the "from file1 left join file 2 on F1key1=F2key2 and
F1Key2=F2Key2" kind of syntax.
I don' care a lot for how it formats the statement either, but
you can always clean it up in an editor.
Sam
"Cole" <cole...@yahoo.com> wrote in message
news:38a074e8.02101...@posting.google.com...
Cole
Drew Dekreon <drew_d...@chugachelectric.com.x.com> wrote in message news:<uqs2vdt...@corp.supernews.com>...
Thanks,
Cole
"Sam L." <none...@nonesuch.com> wrote in message news:<Senr9.201$g64....@eagle.america.net>...
HTH
Phil
"Cole" <cole...@yahoo.com> a écrit dans le message de news:
38a074e8.02101...@posting.google.com...
--
Kent Milligan, DB2 & BI team
PartnerWorld for Developers, iSeries
km...@us.removethis.ibm.com GO HAWKEYES!!
>>> www.iseries.ibm.com/db2
(opinions stated are not necessarily those of my employer)
Some one has pointed you to RUNSQLSTM to run a series of SQL
statements, each terminated with a ";", from a source file. Be
aware that all you can do by way of output is "INSERT INTO myFile
(SELECT SUM(AnyFile) FROM AnyFile)" type of stuff, though this
isn't a huge restriction, and you can't pass parameters. With
*QMQRY you can do "SELECT SUM(AnyFile) FROM AnyFile" and create a
new file on the fly, though I believe the output data is
processed twice.
If you go with "compile" *QMQRY type objects you can pass in
parameters, but you are restricted to single SQL statements, thus
you need to string them together with CL.
SQL facilities on the AS/400:
STRSQL (interactive SQL.)
STRQM (interactive building of *QMQRY objects.)
Embedded SQL in RPG or Cobol.
SQL stored procedures written in SQL procedural language. (Used
to require a C compiler, but as of V5R1 or V5R2 the compiler is
no longer necessary.)
The above need the SQL Development Kit, an extra cost option.
RUNSQLSTM (runs one or more SQL statements from a source file.)
CRTQMQRY (build *QMQRY objects from source)
STRQMQTY (run *QMQRY objects.)
Sam
"Cole" <cole...@yahoo.com> wrote in message
news:38a074e8.02101...@posting.google.com...
A few more:
-- iSeries Access (aka Client Access) has a Run SQL Scripts facility
-- CLI API is part of OS/400, which is like ODBC
-- JDBC
--
Karl Hanson
I presume you mean in iSeries Navigator, formerly Operations
Navigator, which is an optional installed part of iSeries Access.
(Or am I confused about the names? I just love trying to keep up
with IBM's product names.)
Peter Gulutzan
www.ocelot.ca
Co-Author of SQL Performance Tuning (http://www.ocelot.ca/tuning.htm)