There isn't a documented function for doing that comparison directly. As
long as both types are identical (which they are in your code), the you can
use the deccmp() function:
rc1 = deccmp(&start_date.dt_dec, &today.dt_dec);
rc2 = deccmp(&today.dt_dec, &end_date.dt_dec);
if (rc1 <= 0 && rc2 >= 0)
{
/* Run a shell program */
}
rc1 will be -1 is start_date is earlier than today
0 if it is the same
+1 if start_date is later than today
DECUNKNOWN if either value is null
If your types aren't the same type, then you need to extend one or the
other (or both) until they are identical and then do the comparison above.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
>From: Sham.Vaidya@rmy.emory.edu
>Date: 29 Oct 1996 12:10:03 -0800
>X-Informix-List-Id: <news.29885>
>
>Could someone help me on my current problem. Below is whats in my ESQL/C
>program running on a Sun SPARC system.
>-----------------
>
>EXEC SQL BEGIN DECLARE SECTION;
> datetime year to day start_date, today, end_date;
>EXEC SQL END DECLARE SECTION;
>
>$ SQL STATEMENT TO GET start_date and end_date
>$ dtcurrent(&today);>
>/* How do i do a compare of the dates? so that I can do an */
>
>if ( start_date < today < end_date )
> {
> /* run a shell program */
> }