I'm trying to select into from a logical file to a data struct from this same logical file but I was getting NULL errors.
I decided to coalesce every single field but now I'm getting -420 and I'm not really sure why since the same query works in STRSQL
Something like above, but with way more fields. Wondering what's wrong with it and if there's a better way to handle SQLRPGLE nulls like AWLNULL.
Field3 is a packed 7:2 field. When I tested with Errind, that field is the one with null values. But on coalesce, it fails.
I decided to coalesce every single field but now I'm getting -420 and I'm not really sure why since the same query works in STRSQL
Code:
Dcl-ds Record Ext Extname('File1') End-ds;
Dcl-s Holder Char(10) ;
Exec-sql Set Option Commit = *None ;
Exec-sql
Select Coalesce(Field1, ' '),
Coalesce(Field2, ' '),
Coalesce(Field3, 0.0),
Coalesce(Field4, ' ')
Into :Record
From File1
Where Field1 = :Holder ;
Field3 is a packed 7:2 field. When I tested with Errind, that field is the one with null values. But on coalesce, it fails.




Comment