× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I've created several UDF's without the C compiler.
http://faq.midrange.com/data/cache/185.html
http://archive.midrange.com/midrange-l/200202/msg01160.html

Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin




"Goodbar, Loyd (AFS-Water Valley)" <LGoodbar@afs.bwauto.com>
Sent by: midrange-l-admin@midrange.com
08/02/2002 10:45 AM
Please respond to midrange-l


        To:     "'midrange-l@midrange.com'" <midrange-l@midrange.com>
        cc:
        Fax to:
        Subject:        RE: CYMD dates and SQL


I have created a process for CYMD2DATE and DATE2CYMD. Unfortunately,
without
a C compiler, I cannot create user-defined functions to use them.... The
create function... parms may not be exactly right, as I was reading
through
the programming manual while writing them. However, the code inside the
return() is correct. Cymd2date() assumes the size of an integer is 10.
These
routines are not optimized (especially cymd2date()).

create function date2cymd(indate date) returns integer
language sql
deterministic
begin
return(
   cast(
      strip(char(int(substr(char(year( indate )),1,2))-19))||
      substr(char( indate ,iso),3,2)||
      substr(char( indate ,iso),6,2)||
      substr(char( indate ,iso),9,2)
   as integer)
);
end

create function cymd2date(incymd integer) returns date
language sql
deterministic
begin
return(
   date(
      strip(char((int(substr(substr(digits( incymd ),4,7),1,1))
         +19)))||
      substr(substr(digits( incymd ),4,7),2,2)||'-'||
      substr(substr(digits( incymd ),4,7),4,2)||'-'||
      substr(substr(digits( incymd ),4,7),6,2)
   )
);
end

Can someone with SQL development kit and C compiler compile these
functions
and verify they compile and work? Are the functions standalone objects
that
could be saved and emailed?

Select date2cymd(curdate()) ... Should return 1,020,802
Select date2cymd(date('1999-12-31')) ... Should return 991,231
Select cymd2date(1020802) ... Should return 08/02/02 (USA)
Select cymd2date(0991231) ... Should return 12/31/99 (USA)

Thanks,
Loyd
_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.