Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
"Sandy Spiers" — — source: Informix-list mailing list archive (1991-1998)
steve,
Steve,
I ran your little bit of code using informix 4.00 and 5.0 engine and it does
crash on the assignment with
FORMS statement error number -1218.
String to date conversion error
so my guess is that you have a WHENEVER ERROR routine being called which is
trapping the error for you.
One way of validating that you did get a date passed is to code a WHENEVER
ERROR CONTINUE, do the assignment, then check to see if the variable IS NULL
and finally turn the error handling back on. I have added a couple of lines
to your little code fragment.
MAIN
DEFINE l_date DATE
WHENEVER ERROR CONTINUE
LET l_date = ARG_VAL(1)
IF l_date IS NULL THEN
DISPLAY "INVALID DATE PASSED"
END IF
END MAIN
This now traps for the situation where a text string is passed as ARG_VAL or
even when an invalid date is passed like 34-01-96 for example. The target
variable l_date is null when the assignment fails.
Hope this helps
--
Cheers Phone: 0131-479-1271
sandys EMail: sandys@easter.euro.csg.mot.com
"Let it be secret and sudden" Sir James Dalrymple, 20 January 1692.
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.