For a fairly detailed explanation, try this:
[1]
http://www.code400.com/forum/showthread.php/257-Null-Values-and-SQL-Fetch
From: "Monahan, Kevin" <KMonahan@xxxxxxxx>
To: <rpg400-l@xxxxxxxxxxxx>
Date: 08/18/2010 08:37 AM
Subject: SQLRPGLE Fetch with Null field values
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
--------------------------------------------------------------------------
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.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [2]
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [3]
http://archive.midrange.com/rpg400-l.
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
Unless you are the addressee (or authorized to receive for the addressee),
you may not use, copy or disclose to anyone this email or any information
contained in this email. If you have received this email in error, please
advise the sender by replying to this email, and delete this email
immediately. Please note that any views or opinions presented in this
email are solely those of the author and do not necessarily represent
those of Western Dental Services, Inc. Finally, the recipient should check
this email and any attachments for the presence of viruses. Western Dental
Services, Inc. accepts no liability for any damage caused by any virus
transmitted by this email.
References
Visible links
1.
http://www.code400.com/forum/showthread.php/257-Null-Values-and-SQL-Fetch
2.
http://lists.midrange.com/mailman/listinfo/rpg400-l
3.
http://archive.midrange.com/rpg400-l
As an Amazon Associate we earn from qualifying purchases.