Why not using datastructures?
D MyCsrDS DS
D Fld1 10A
D Fld2 3P 0
....
D FldN 20A
D MyIndDS DS
D ArrInd 5I 0 Dim(N)
Exec SQL Fetch Next From MyCsr into :MyCsrDS :MyIndDS;
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 Mike Cunningham
Gesendet: Tuesday, 05. October 2010 19:08
An: RPG programming on the IBM i / System i
Betreff: RE: RPG SQL and database null values
I could see one use. The IFULL would only operate on the null field and set
a value. The null indicator could be used to do something special to another
field.
IF fieldA = NULL then fieldB = '*DEFAULT"
IFNULL would probably work in 99% of the cases where it is needed.
I have to deal about 5 tables with a total of about 200 fields. Defining a
null indicator field for each and doubling the FETCH command to read both
would be a pain. So for me I am going to try the IFULL function and
hopefully save myself some finger cramps.
p.s. sure wish database designers would think before using the default of
NULL and only allow nulls where they actually make sense
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Robert Mullis
Sent: Monday, October 04, 2010 5:52 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: RPG SQL and database null values
How is using a null indicator more appropriate than IFNULL or COALESCE?
On 10/4/2010 5:15 PM, Scott Klement wrote:
Hi Mike,
The ALWNULL option is for RPG's native I/O functions (i.e. F-spec
files) it's not related to embedded SQL.
For embedded SQL, you might use IFNULL/COALESCE as others have
suggested, or simply define a null indicator and handle null values
appropriately.
On 10/4/2010 3:38 PM, Mike Cunningham wrote:
Is there an easy way to deal with null values being read by RPG using
embedded SQL? I can't get by the -305 error when there is a null
value coming in. ALWNULL(*INPUTONLY) has already been tried and did
not help. I do not need to know when a field is null in this
application. Getting the default value for the field type will be OK
in my situation. Is the null indicator variable the only way?
--
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:
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
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.