Hi Kolusu, and thanks for your help. I have been out for a few days, and got to work with it today. It is just what I need, and is easy enough to change the volume of data to add another month (which I was going to try later).

I appreciate all that you do, and for your expert knowledge!

Thank you and best regards,
Billy Ashton

------ Original Message ------
From "Sri h Kolusu" <[email protected]>
To [email protected]
Date 6/30/2022 6:14:04 PM
Subject Re: Using SORT to generate sequential Dates

Billy,

If I understand your requirement correctly, you need current month begin to end 
and 1 or 2 months before the current month. So if you are run the job 
today(June 30th), it will generate the dates from April 1st to June 30th.   If 
you run the job on July 1st then it would generate dates beginning May 1 thru 
May 31 , June 1 thru June 30 and July 1 thru July 31. If that is true, then use 
the following job which will give you the desired results.

//***************************************************************
//* Generate DFSORT symbols for begin date and repeat value     *
//* Begindate  =  Current month - 2 months (CCYYMM)  01         *
//* Enddate    =  Last day of the current month (CCYYMMDD)      *
//* Repeatval  =  Number of entries (Enddate - Begmmdd)         *
//***************************************************************
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD DSN=&&S,DISP=(,PASS),SPACE=(TRK,(1,0))
//SYSIN    DD *
 OPTION COPY,STOPAFT=1,NULLOUT=RC4
 INREC OVERLAY=(01:DATE2-2,C'01',
                11:DATE1,
                21:11,08,Y4T,LASTDAYM,TOGREG=Y4T,
                31:21,08,Y4T,DATEDIFF,01,08,Y4T)

 OUTFIL BUILD=(C'SDATE,C''',01,08,C'''',/,
               C'EDATE,C''',21,08,C'''',/,
               C'RPVAL,',31,08,UFF,ADD,+1,M11,LENGTH=8,
               80:X)
/*
//***************************************************************
//* Use the symbols from previous step and generate the data    *
//***************************************************************
//STEP0200 EXEC PGM=SORT,COND=(0,LT)
//SYSOUT   DD SYSOUT=*
//SYMNOUT  DD SYSOUT=*
//SYMNAMES DD DISP=(OLD,PASS),DSN=&&S
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
 OPTION COPY,STOPAFT=1,NULLOUT=RC4
 OUTFIL REPEAT=RPVAL,
 IFOUTLEN=80,
 IFTHEN=(WHEN=INIT,
      OVERLAY=(081:SDATE,
               091:SEQNUM,3,ZD,START=0,
               101:081,08,Y4T,ADDDAYS,091,3,ZD,TOGREG=Y4T)),
 IFTHEN=(WHEN=INIT,
 BUILD=(C'(''',C'D',SEQNUM,3,ZD,C''',',
        C'''',101,04,C'-',105,02,C'-',107,02,C''',',
        C'''',101,08,C''',',
        101,08,C',',
        C'''',101,02,C''',',
        C'''',103,02,C''',',
        C'''',105,02,C''',',
        C'''',107,02,C''')'))
/*


Thanks,
Sri Hari Kolusu
DFSORT Development
IBM Corporation


-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Billy Ashton
Sent: Thursday, June 30, 2022 2:30 PM
To: [email protected]
Subject: [EXTERNAL] Re: Using SORT to generate sequential Dates

Kolusu, the key data is that I have the previous month start and end date (for 
today, it would be May 1 and 31), with some range of dates before that. I also 
need at least the end of the current month (June 30, today). For running it 
tomorrow, I need at least June 1 - 30 (with some dates in May) and July 1 to 31.
Having more dates than this is fine, and is no problem to go back even another 
month and ahead even another month.

Billy

Sri h Kolusu wrote:



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)



Billy,

It is easy to generate the dates in the required format, however  a
few clarifications needed.
•       Can the dates start from current date and go back to 3 months
of dates?
•       Do you want the ability of passing ANY VALID date and number
of entries needed?
•       3 months dates can result in 88 - 93 entries depending on the
current date. For example today's  Current-date is 2022-06-30 and
subtracting 3 months from it results in 2022-03-30. So we can have the
start date from March 30th and get to Current date which will be 93
days of data. Is that OK? If we always use 93 as number of entries to
generate then it might exceed the current date.  I can handle it
dynamically have the repeat value. Is that needed ? or is it ok to
have 93 entries of data?


Thanks,
Kolusu
DFSORT Development
IBM Corporation



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send
email to [email protected]<mailto:[email protected]> with the 
message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected]<mailto:[email protected]> with the message: 
INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to