On Thu, 30 Jun 2022 20:23:16 +0000, Billy Ashton  wrote:
>    ...
>I would like to use SORT to generate a file ...
>
>I need this for about 3 months worth of dates. The dates should start 
>either on the 15th of the month, 2 months ago, or 45 days ago (whichever 
>is easier) and go up through the end of the current month (it could even 
>start on the 1st day of 2 months ago if necessary). So for today (June 
>30), it would have
>('D001','2022-04-15','20220415',20220415,'20','22','04','15')
>
I tried this in Rexx.  I found it astonishingly hard to get "the end of the 
current month".
Would DFSORT do betteer?  Anyway, with no attention to formatting:

trace N
signal on novalue

Bas = date( 'Base' )
Std = date( 'Standard', Bas, 'Base' )
parse var Std YM 7 .

MBeg = date( 'Base', YM'01', 'Standard' ) /* Beginning of this month */
Nextm = date( 'Standard', MBeg + 45, 'Base' )  /* Middle of next month */
parse var Nextm Nextm 7 .
Nextm = date( 'Base', Nextm'01', 'Standard' ) /* First of next month */

Offset = Bas - 46
Do DDDD = Bas - 45 to Nextm - 1
    say DDDD - Offset date( 'Standard', DDDD, 'Base' )
    end DDDD

/* Not tested for December, January, or February.  */

-- 
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to