SQL error
750 pts.
0
Q:
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: Sep 27 2009  4:57 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
24610 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
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 Answered: Sep 28 2009  4:43 PM GMT by Philpl1jb   24610 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Nutangujar   750 pts.  |   Sep 28 2009  3:47PM GMT

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?

 

Graybeard52   2435 pts.  |   Sep 28 2009  10:48PM GMT

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

 
0