It's not the most elegant thing around, but I have an XL-resident subprogram
DTDIF which does a very nice job (accurate, too, and no cobol85 or HP date
functions) of validating all of and computing the missing member of
DATE1
DATE2
DAYSDIFF
I bet that would do your trick with very easy minor mods:
1) compile to standalone executable
2) deal with gathering its 32-bit binary parms from JCWs
If you're really using DOY, convert that to a CCYYMMDD date using
appropriate pieces of Donna's oops donna's script. But if you're really
using $TODAY,
plug HPCCYYMMDD into DATE1
plug a ZERO into DATE2
plug your DAYS-DIFF factor into DIFF
run DTDIF
and get an accurate DATE2 in CCYYMMDD format.
want a copy? it's 272 lines of code, including...
1 $CONTROL DYNAMIC, USLINIT
1.1 IDENTIFICATION DIVISION.
1.2 PROGRAM-ID. DTDIF.
1.3 *861206 KTP written.
1.31 *971014 KTP added 'windowed' century support for 6-digit dates:
1.311 * **************************************************
1.312 * * *
1.32 * * CC assumed 19 if YY > 80, else CC assumed 20. *
1.321 * * *
1.322 * **************************************************
1.33 *991108 KTP fix bug in assumed century 2nd-date-validation per PL.
1.4 DATE-COMPILED.
1.5 REMARKS. General-usage subroutine which determines either
1.6 the difference in days between two dates
1.7 OR
1.8 the second date, given first date & number of days.
1.9
2 PARM FORMATS (COBOL):
2.1 FIRST-DATE PIC S9(09) COMP (CCYYMMDD FORMAT);
2.2 SECOND-DATE PIC S9(09) COMP (CCYYMMDD FORMAT);
2.3 DAYS-DIFF PIC S9(09) COMP.
2.4
2.5 SAMPLE CALL (COBOL):
2.6 CALL "DTDIF" USING FIRST-DATE SECOND-DATE DAYS-DIFF.
2.7
2.8 NOTES:
2.9 If dates passed do NOT contain CENTURY, date range is
3 assumed to be 1981-2080: 810101=19810101,801231=20801231.
3.1 ACTION OF PROGRAM:
3.2 IF FIRST-DATE INVALID,
3.3 MOVE 999999999 TO FIRST-DATE, EXIT.
3.4 ELSE
3.5 ELAPSED = DAYS(FIRST-DATE)
3.6 END-IF
3.7 IF SECOND-DATE <> ZERO,
3.8 IF SECOND-DATE INVALID,
3.9 MOVE 999999999 TO SECOND-DATE, EXIT
4 ELSE
4.1 ELAPSED = -ELAPSED
4.2 ELAPSED += DAYS(SECOND-DATE)
4.3 EXIT
4.4 END-IF
4.5 ELSE
4.6 SECOND-DATE = DATE(ELAPSED + DAYS-DIFF)
4.7 EXIT.
Tracy Pierce
> -----Original Message-----
> From: Bob McGregor [mailto:[log in to unmask]]
> Sent: Tuesday, May 27, 2003 10:30 AM
> To: [log in to unmask]
> Subject: Re: Converting HPDOY
>
>
> Actually what I'd like to do is
>
> setvar testdoy,hpdoy - 2
>
> and then convert testdoy to a date in mmddyy (or any) format
>
> On Tuesday, May 27, 2003 11:24 AM, [log in to unmask] wrote:
> >The variable HPYYYYMMDD will give you the date.
> >
> >Brian.
> >
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|