Is it possible to give a date field a blank value ?
I use iSeries Navigator to create my tables and RPGLe as program language.
I can't find anything about this...
i already tried things like
eval testdate = *blanks
eval testdate = null
eval testdate = 0
Any ideas ? i would be very grateful !
Thanks
> Is it possible to give a date field a blank value ?
no, blank is not a date
> eval testdate = *blanks
> eval testdate = null
> eval testdate = 0
assuming you've declared testdate as *ISO
eval testdate = '0001-01-01'
is the way to go
HTH
Rolf
--
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
! Dipl.Inf.(FH) Rolf P Mittag IBM Partner in Development !
! Leipziger Str. 50 D-69214 Eppelheim !
! Fon: +49 (6221) 76 78 60 Fax: +49 (6221) 76 80 26 !
! eMl: r...@r-m-e-d-v.de !
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
For any date type you can use *HIVAL or *LOVAL so you can check if the date
in in range for those 2 digit year date formats.
--
Jonathan Bailey.
Hi Inge,
if I understand clearly, you create your files using SQL instead of
DDS.
How are the fields defined? With "Date not Null" or simply with
"Date"?
In the first case the date will never be NULL.
Do you use native I/O or embedded SQL to read your files?
When using native I/O and NULL Values are allowed, you have to use the
built-in-function %NullInd to detect or set Null values.
If Null-Values aren't allowed, you can use *Loval to find if the field
is filled. The value of *loval depends on the date format. Using date
format *ISO, *EUR, *USA or *JIS, *loval is Janurary 1st year 1. Using
date format *DMY, *MDY, *YMD, *loval is January 1st year 1940.
When using embedded SQL, you can detect NULL values using IS NULL or
an Indicator variable. Or you can use SQL Scalar Function Coalesce to
convert Null values into a default value.
Be aware, the date format used by SQL is not determined by the date
format in the H- or D-Specs. It is fixed at compile time either
through compile option DATFMT or SET OPTION statement embedded in your
source code.
Birgitta