895 pts.
 SQL error
I've a cursor to fetch date from DB2/400...When date is stored as

0001-01-01, I get error - Year portion of the Date not in correct range. This is the default date my update program stores when user doesnt enter anything for date field. How can I bypass this error while fetching SQL cursor in my SQL RPGLE program?

Thanks,

NG



Software/Hardware used:
AS400 - SQLRPGLE
ASKED: September 27, 2009  4:57 PM
UPDATED: September 28, 2009  10:48 PM

Answer Wiki:
Is this an SQL error that you get or an error generated by your programs? Phil ========================================================================== You could use DSPATR(ND) to "hide" the value when you don't want it displayed. Phil =========================================================================
Last Wiki Answer Submitted:  September 28, 2009  4:43 pm  by  philpl1jb   44,630 pts.
All Answer Wiki Contributors:  philpl1jb   44,630 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

well…just realized that the error is generated by program when i try to execute
*mdy move date1 date2

my screen field for date is of data type ‘date’ i want to display blanks when the date is 01/01/0001
can i achieve this without changing the screen field type?

 895 pts.

 

You have a couple of choices. One is to test the date1 field for D’0001-01-01″ and seton an indicator to make the field non-dosplay when this happens. Another option is to define the screen field as a char or numeric field. Then you could yo something like this.
If date1 = *loval
eval date 2= *blanks
else
eval date2 = %char(date1:*mdy)
endif

 3,115 pts.