|
Don, This code does not work across the 1999-2000 boundary (I tested it.) CL can do simple math well, but I would offer the opinion that date math is not simple. Buck Calabro > -----Original Message----- > From: Searsdon@aol.com > Sent: Friday, January 07, 2000 3:03 PM > To: RPG400-L@midrange.com; rbrightman@amclog.com > Subject: Re: doing date arithmetic in CL > > I Think this example should help you: > the basic idea was to change a date to a julian date, decrement by a week > and > then convert baack to a standard date. I've been doing simple cl math > scince > the 80's this way. > > DCL VAR(&DATE) TYPE(*DEC ) LEN(8 0) > DCL VAR(&CDATE) TYPE(*CHAR) LEN(6) > DCL VAR(&CENDATE) TYPE(*CHAR) LEN(8 ) > DCL VAR(&JULDATE) TYPE(*CHAR) LEN(5 ) > START: RTVSYSVAL SYSVAL(QDATE) RTNVAR(&CDATE) > CVTDAT DATE(&CDATE) TOVAR(&JULDATE) FROMFMT(*MDY) + > TOFMT(*JUL) TOSEP(*NONE) > CHGVAR VAR(&DATE) VALUE(&JULDATE) > CHGVAR VAR(&DATE) VALUE(&DATE - 7) > CHGVAR VAR(&JULDATE) VALUE(&DATE) > CVTDAT DATE(&JULDATE) TOVAR(&CENDATE) FROMFMT(*JUL) + > TOFMT(*YYMD) TOSEP(*NONE) > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
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.