× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I've been reading "SQL/400 Developer's Guide" by Paul Conte - Mike Cravitz
http://www.amazon.com/exec/obidos/ASIN/1882419707/midrangedotcom
It's pretty good.

Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin




"Dennis Lovelady" <dlovelady@dtcc.com>
Sent by: midrange-l-admin@midrange.com
11/04/2002 08:00 AM
Please respond to midrange-l

        To:     midrange-l@midrange.com
        cc:
        Fax to:
        Subject:        SQL for beginners



Hello, all:

Where can I find good reference material for beginning the learning
process
for imbedded SQL?

I've been programming IBM midrange systems since the inception of the
System/3, but I've been lax about implementing some of the more modern
approaches to retrieving data.

I'd like to learn how to begin implementing imbedded SQL into
applications.
I want to start with something simple, and I've the perfect project for
that now in my hot lttle hands.  I do understand SQL, having been an
Oracle
DBA for a number of years; just haven't put the two together to date.

For this application, I merely want to read one table beginning to end (I
have no problem with this ... the DECLARE CURSOR  stuff and the FETCH for
that table all make sense to me).  This data has an employer and an
employee number associated with it... and I want to use those to pull a
couple of columns from the employee master file.

I *THOUGHT* I understood this, but there's something I'm missing.  Once I
get a "not found" condition, I can't seem to reset it.  So I know this is
a
fundamental gap, and I'd like to be able to overcome it.

I've been looking at the DB2 UDB for iSeries SQL Programming ... book, and
though it has some examples, there's nothing quite so simple, and I think
I
need simplicity at this point to understand why the following won't work:

C/EXEC SQL   WHENEVER NOT FOUND Goto NotFound
C/END-EXEC
C/EXEC SQL   WHENEVER SQLERROR Goto SQL_Error
C/END-EXEC
C/EXEC SQL   DECLARE TransFile Cursor for
  + Select <stuff omitted> From PRPRLCTER
C/END-EXEC
C/EXEC SQL   DECLARE MstrFile Cursor for
 + Select    PRLNM, PRSTAT, PRLCOD
 + From      PRPMS
 + Where     PRER = :EMPLOYER
 +      and  PREN = :EMPLOYEE
 + FOR FETCH ONLY
C/END-EXEC
C/EXEC SQL   OPEN TransFile
C/END-EXEC
C/EXEC SQL   OPEN MstrFile
C/END-EXEC

C                   DoW       SQLCOD = 0
C/EXEC SQL   FETCH TransFile INTO :TransBuff
C/END-EXEC
C                   If        SQLCOD = 0
C/EXEC SQL   Fetch MstrFile  INTO :MstrBuff
C/END-EXEC

...

In initial testing, the above seems to work splendidly for the first
cycle,
where there is a match, but once the mismatch occurs (cycle 2), I'm out of
luck.

I'm not looking for anyone to "do my homework" here, but would like a good
place to find fundamental examples, and learn where I might be going
wrong.

Thanks for indulging....
Dennis


_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.