Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

setting date to blanks or null

1,703 views
Skip to first unread message

Inge Jacobs

unread,
Aug 6, 2004, 3:29:51 AM8/6/04
to
Hello,

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


Rolf Mittag

unread,
Aug 6, 2004, 4:58:35 AM8/6/04
to
Hello,

> 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 !
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

jb

unread,
Aug 6, 2004, 5:45:06 AM8/6/04
to
"Inge Jacobs" <Ing...@stijn.be> wrote in message
news:4113338a$0$294$ba62...@news.skynet.be...
For nulls you need
HALWNULL(*USRCTL) -or *INPUTONLY
Then manipulate a field -
eval %nullind(testdate)=*on -sets the field to null *off sets not null.
It seems the value in the field stays valid & the same as last time it was
not null.
eval ind=%nullind(testdate) -gets the null flag fo the field. I havnt
managed to setup any pogam fields as nullable only those from externally
descibed files with ALWNULL on the field.

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.


Drew Dekreon

unread,
Aug 6, 2004, 6:49:23 PM8/6/04
to
doesn't that have to be
eval testdate=d'0001-01-01'?
I think you can also do
*iso move d'0001-01-01' testdate
this frees you from having to worry about what form testdate was
declared as.

Birgitta Hauser

unread,
Aug 7, 2004, 1:39:20 PM8/7/04
to
"Inge Jacobs" <Ing...@stijn.be> wrote in message news:<4113338a$0$294$ba62...@news.skynet.be>...

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

0 new messages