In oracle exists a function NVL(a,b) which will return b if a is null.
In sql server I think you can achieve the same by using COALESCE or isNull functions.
I don’t know if you can use some of these functions in AS/400. I think COALESCE is based on the ANSI SQL standard, so it is possible that you can use it.
If that’s the case, the query should be constructed like this:
where name = :name
and date = coalesce(:date,date)
This way, if :date is null, the date field will be compared to itself, which produces the same result as if the condition did not exist.
Hope this helps.