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



Hi,

You need an array of 5I 0 fields (indicator variables) with an element for
each selected field.
The array must be specified in the Fetch clause after the data structure
only separated by a blank (NOT a comma).
The element for the appropriate field is set to -1 if an NULL value is
returned and 0 if a value was returned.
You need to check these indicator variables

D MyIndArr S 5I 0 Dim(NbrOfFields)

/Free
Exec SQL Fetch next from SelectStmt into :DSSis800 :MyIndArr;

If MyIndArr(3) < *Zeros;
//NULL Value within the 3rd column
EndIf;

BTW in your example dynamic SQL is NOT necessary!

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Monahan, Kevin
Gesendet: Wednesday, 18. August 2010 17:37
An: rpg400-l@xxxxxxxxxxxx
Betreff: SQLRPGLE Fetch with Null field values

Hi all, I need help!
I'm trying to run a SQLRPGLE program with a Fetch Into clause with
possible null values.

The Select statement (skinnied down) is as follows:
Sel = 'Select oh, +
a.WHSE, a.SKU, a.HANDLCDE, a.COORDGRP, a.OH#MMS, +
From @SISYNWRK a left join @synppoh1d on a.sku = icmpno +
Where ( a.Flg_01 = '' '' and a.flg_08 = '' '') +

and a.Whse = ? and a.sku not in (select isetno from sethdr) ';


The Fetch is
Fetch Next from SelectStmt into :DSSis800

The host variable DSSis800 is defined as
d DSSis800 e ds extname(@SIS800WPF)

and the field OH is defined in DDS as 6S 0 with ALWNULL and DFT(0)

When I run the program I get a message "Indicator variable required."
and no data is copied.

How can I get this to populate the external data structure (I run the
Fetch through a Do Loop and write to the file), or how do I define an
"Indicator variable" for the null-capable field?

Thanks,
Kevin Monahan
Systems Analyst
Casual Male Retail Group
781-828-9300 x2785
kmonahan@xxxxxxxx




Confidentiality Note: This e-mail, and any attachment to it, contains
privileged and confidential information intended only for the use of the
individual(s) or entity named on the e-mail. If the reader of this e-mail is
not the intended recipient, or the employee or agent responsible for
delivering it to the intended recipient, you are hereby notified that
reading it is strictly prohibited. If you have received this e-mail in
error, please immediately return it to the sender and delete it from your
system. Thank you.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.