Can you add SET OPTION in your function to set your date format to *ISO?
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Rob Berendt
Sent: Thursday, April 4, 2019 10:34 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: date UDF
Because your job date is *MDY and not *ISO
Sample:
STRSQL
F13=Services
1. Change session attributes
Date format *ISO
values date('2043-04-04')
....+....1
VALUES
2043-04-04
******** End of data ********
Now, if I use F13 and change my date format to *MDY
....+...
VALUES
++++++++
******** End of data ********
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jay Vaughn
Sent: Thursday, April 4, 2019 10:24 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: date UDF
why is my UDF considering '2019-04-04' a valid date but not '2043-04-04'?
---
create or replace function
lscnvtools/IsValidDate (i_dateField varchar(10)
,i_dateValue varchar(10)
,i_rowKey varchar(10)
,i_rowVal varchar(50)
)
returns char (1)
language sql
returns null on null input
modifies sql data
begin
declare g_charDate date;
declare continue handler for SQLState '22007'
begin
insert into cnverr (erpgmid
,errowkey
,errowval
,ersrccol
,ermsgtxt)
values ('CNVPFSQLR'
,i_rowKey
,i_rowVal
,i_dateField concat ' ' concat i_dateValue
,'Invalid Date Value');
return 'N';
end;
if i_dateValue is null then
return 'N';
end if;
set g_charDate = Date(i_dateValue);
return 'Y';
end
TIA
jay
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.