× 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.



Tim,

Here's some snipets of what I have:

You need to account for the null indicator.  Here's how I do that:
     D*------------------
     D matTktDS      e ds                  extname(mater00002) prefix(mt_)
     D matTktI         s              5i 0 occurs(arraySize)
     D                                     based(p_nullDS)
     D*------------------

and I need to define this as well.  MATER00002 has six columns:

     D arraySize       c                   const(1)
     D  nullArr                       5i 0 dim(arraySize)
     D nullDS          ds                  occurs(arraySize)
     D  null1                         5i 0
     D  null2                         5i 0
     D  null3                         5i 0
     D  null4                         5i 0
     D  null5                         5i 0
     D  null6                         5i 0
     D p_nullDS        s               *   inz(%addr(nullDS))

Then I code the FETCH like this (notice NO comma between the two host
variables):

     C/exec sql
     C+ FETCH NEXT FROM @CURSOR INTO :matTktDS:matTktI
     C/end-exec

Then for each null capable field I have to test for it (in this case, the
sixth column is mt_Notes and is null capable):

     C                   if        null6 < *zero
     C                   eval      mt_Notes = *blank
     C                   endif

Let's say you're selecting two columns only on your SELECT stmt, and one is
null capable.  You could do this:

     C/exec sql
     C+ FETCH NEXT FROM @CURSOR INTO :cusnbr, :lastDate:lastDateI
     C/end-exec

The arraySize constant:  I use this because often I'm fetching multiple rows
into a MODS.  Then what I do is an OCCUR for each row returned on both the
matTktDS and nullDS and test for null each time.

Phil



> -----Original Message-----
> From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On
> Behalf Of Hatzenbeler, Tim
> Sent: Friday, October 12, 2001 5:57 PM
> To: 'rpg400-l@midrange.com'
> Subject: Sql Skeleton Sample...
>
>
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
> --
> [ Picked text/plain from multipart/alternative ]
> I was wondering, if someone would be willing to share an rpgsql program,
> that is very robust...
>
> I'm looking for the techniques, to be able to handle null values
> (not change
> them) but at least let the rpg continue, plus how to handle the various
> error codes, that might arise..
>
> right now, I have null's in my data data types (lovals), and the
> sql, cann't
> handle these... So I would like the program to at least keep functioning,
> and then let me handle the nulls later when it comes to displaying them...
>
> Thanks, tim
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



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.