|
There are two ways to handle null fields via
sql:
1: Search in the list: "Null fields in SQLRPGLE" in
October 2000 I'v got a complete answer (and a tool too) from David
Morris
2: If you use Select * into ds name you have to add
an array defined as:
DIND_ARRAY
DS
D INDS 4B 0 DIM(50) I set 50 because I've got less than 50 fields in
the ds
The SQL code looks like:
C/EXEC
SQL
C+ FETCH CUR INTO :DBANA0 :INDS C/END-EXEC When you "read" the record via sql you have to test
the value of the correspondig (by position) element in INDS (Eg if ArrivalDt is
the 5th field you have to test INDS(5)) against 0 ( a minus 0 value
indicate a null field (Nice, really nice....)).
Be carefull: if you add a field somewhere
in you format (Eg. in 3rd position) ArrivalDt may become the 6th
field....
Coming back to the problem, you cannot pass back
the %nullind to your java program since there is no support for null fields in
rpg, the only support actually available is over database fields (defining
external files, not external DS) and is compiler handled only. If you define
ALWNULL and your database files have null capable fields you can use
%nullind otherwise...
I think you can set up a second ds sql and send it
back to your java program
You can find more information in:
DB2 UDB for AS/400 SQL Programming (Code: RBAF-Y000-00) Chapter 16. Coding SQL Statements in ILE RPG for
AS/400 Applications . 309
Hope it helps
Marco
|
As an Amazon Associate we earn from qualifying purchases.
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.