|
What about using indicator variables? If you use an indicator variable,
you will not get a negative SQLCOD. Instead the indicator variable will
have the value -2 if the result is null.
0013.00 DInd_DS DS
0014.00 D LREGSQI 2B 0 INZ(0)
0015.00 D LMBRIDI 2B 0 INZ(0)
< SN I P >
0026.00 D LDTCRTI 2B 0 INZ(0)
0027.00 D LMBRAMI 2B 0 INZ(0)
or
DInd_DS DS
INDS 4B 0 DIM(n), where n=
the number of columns
EXEC SQL FETCH C1 INTO :HostRec :Ind_DS
Donna Bryant, CCP
Peek Software Services, Inc
----- Original Message -----
From: "Jeffrey Silberberg" <jsilberberg@mindspring.com>
To: <MIDRANGE-L@midrange.com>
Sent: Thursday, September 28, 2000 11:21 PM
Subject: Need HELP WITH NULL HANDLING IN SQLRPGLE ---
> I have an SQLRPGLE that will not run. The Left outer Join results in a
Null
> Field for LBRNAM
> when there is no LMBR present and I can not figure out how to make LMBRAM
a
> Null
> Capable Field in this Data structure. ??
>
>
> I Get the following in the Joblog each time it runs:
>
> "Message ID . . . . . . : SQL0305
> Date sent . . . . . . : 09/28/00 Time sent . . . . . . :
22:08:06
>
> Message . . . . : Indicator variable required.
>
> Cause . . . . . : A FETCH, an embedded SELECT, a CALL or a SET or VALUES
> INTO statement has resulted in a null value, but an indicator variable
was
> not specified for host variable LMBRAM. The relative position of the
host
> variable in the INTO clause or parameter list is 14. If the host
variable
> name is *N, an SQLDA was specified.
> Recovery . . . : Specify an indicator variable, and precompile the
> program
> again.
> "
>
> Every time i trya nd run it. And between the Info Center and the Books
I
> can not find an
> answer on how to get this to work. Can someone give me a hint please !!
> 0001.00 H ALWNULL(*USRCTL)
> < S N I P >
> 0013.00 DHostRec DS
> 0014.00 D LREGSQ 9 0 INZ(0)
> 0015.00 D LMBRID 9 0 INZ(0)
> < SN I P >
> 0026.00 D LDTCRT 8S 0 INZ(0)
> 0027.00 D LMBRAM 7P 2
> 0029.00 C**
> 0030.00 C/Exec Sql
> 0031.00 C+ DECLARE C1 CURSOR FOR SELECT LREG.LREGSQ, LREG.LMBRID,
> 0032.00 C+ LREG.LFNAME, LREG.LLNAME, LREG.LADDR1, LREG.LZIPC5,
LREG.LZIPC4,
> 0033.00 C+ LREG.LPAYCD, LREG.LREGDO, LREG.LREGAM, LREG.LCCNM, LREG.LEXDT,
> 0034.00 C+ LREG.LDTCRT, LMBR.LMBRAM FROM MEMLIB1/lreg LEFT OUTER JOIN
> 0035.00 C+ memlib1/lmbr ON lreg.lregsq = lmbr.lmbrsq WHERE LREG.LDTCRT =
> 0036.00 C+ :DateSlt FOR READ ONLY
> 0037.00 C/End-Exec
>
>
> TIA,,
> JMS....
>
>
>
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
david@midrange.com
> +---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.