[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Date Variables
- Subject: Re: Date Variables
- From: eddy vasile <evasile@HOTMAIL.COM>
- Date: Tue, 5 Oct 1999 20:26:42 GMT
Couple of things:
1) I assume the database is Oracle > 7.XX because of the date format
(dd-mon-yyyy). Otherwise, you need to play with the date mask.
2) The procedure is local (otherwise global variables have to be $_maxdate,
$mindate
-------------
If these assumptions are correct, the program should work fine. Here's an
adaptation that covers all possiblities and produces the correct output
ASSUMING YOU ARE WORKING WITH ORACLE! (AND YOU RUN WITH / -XL)
BEGIN-SETUP
DECLARE-VARIABLE
DATE $MINDATE
DATE $MAXDATE
END-DECLARE
END-SETUP
begin-program
do compare-dates0
end-program
BEGIN-PROCEDURE COMPARE-DATES0
LET $MAXDATE = '01-SEP-1999'
LET $MINDATE = '31-AUG-1999'
SHOW 'MAX DATE = ' $MAXDATE
SHOW 'MIN DATE = ' $MINDATE
IF $MAXDATE = $MINDATE
SHOW 'MAXDATE = MINDATE'
END-IF
IF $MAXDATE <> $MINDATE
SHOW 'MAXDATE <> MINDATE'
END-IF
IF $MAXDATE > $MINDATE
SHOW 'MAXDATE > MINDATE'
END-IF
IF $MAXDATE < $MINDATE
SHOW 'MAXDATE < MINDATE'
END-IF
do compare-dates1
END-PROCEDURE
BEGIN-PROCEDURE COMPARE-DATES1
LET $_MAXDATE = '01-SEP-1999'
LET $_MINDATE = '31-AUG-1999'
SHOW 'MAX DATE = ' $_MAXDATE
SHOW 'MIN DATE = ' $_MINDATE
IF $_MAXDATE = $_MINDATE
SHOW 'MAXDATE = MINDATE'
END-IF
IF $_MAXDATE <> $_MINDATE
SHOW 'MAXDATE <> MINDATE'
END-IF
IF $_MAXDATE > $_MINDATE
SHOW 'MAXDATE > MINDATE'
END-IF
IF $_MAXDATE < $_MINDATE
SHOW 'MAXDATE < MINDATE'
END-IF
END-PROCEDURE
>From: Kenny Melton <KMELTO1@TANDY.COM>
>Reply-To: SQR-USERS@list.iex.net
>To: Multiple recipients of list SQR-USERS <SQR-USERS@list.iex.net>
>Subject: Date Variables
>Date: Tue, 5 Oct 1999 14:59:25 -0500
>
>Hello Everyone,
>
>I am using SQR 4.3.4 and am having a strange problem (or a severe brain
>burp). Can anyone tell me why the following works the way it does?:
>
>BEGIN-SETUP
> DECLARE-VARIABLE
> DATE $MINDATE
> DATE $MAXDATE
> END-DECLARE
>END-SETUP
>
>BEGIN-PROCEDURE COMPARE-DATES
> LET $MAXDATE = '01-SEP-1999'
> LET $MINDATE = '31-AUG-1999'
>
> SHOW 'MAX DATE = ' $MAXDATE
> SHOW 'MIN DATE = ' $MINDATE
>
> IF $MAXDATE = $MINDATE
> SHOW 'MAXDATE = MINDATE'
> END-IF
>
> IF $MAXDATE <> $MINDATE
> SHOW 'MAXDATE <> MINDATE'
> END-IF
>
> IF $MAXDATE > $MINDATE
> SHOW 'MAXDATE > MINDATE'
> END-IF
>
> IF $MAXDATE < $MINDATE
> SHOW 'MAXDATE < MINDATE'
> END-IF
>
>END-PROCEDURE
>
>The log file output looks like this:
>
>MAX DATE = 01-SEP-1999
>MIN DATE = 31-AUG-1999
>MAXDATE = MINDATE
>
>I'm kind of stumped on this one. I think it has something to do with the
>internal "string" representation of the date variables, but all my juggling
>with the SQR.INI file settings didn't have any impact. I have also tried
>it
>with the "MOVE" command in place of the "LET" command above and, again, no
>difference. Oh, one more thing -- this happens consistently when one of
>the
>dates is an end-of-month date, and the other date is the following
>first-of-month date. OK Gurus, what am I missing?
>
>Thanks in advance,
>Kenny Melton
>Sr. Technical Architect
>Tandy Information Services
>PeopleSoft Financial Systems
>kmelto1@tandy.com
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com