Page 1 of 2

Please help

PostPosted: Mon Jun 19, 2017 8:23 am
by GeorgeQ
I have a jcl job need to be run in every month, for each month I need to manually rewrite the code and add a new month data.

//M20171 DD DSN=A000000.MONTHDT.MONTH1,DISP=SHR
//M20172 DD DSN=A000000.MONTHDT.MONTH2,DISP=SHR
//M20173 DD DSN=A000000.MONTHDT.MONTH3,DISP=SHR
//M20174 DD DSN=A000000.MONTHDT.MONTH4,DISP=SHR
//M20175 DD DSN=A000000.MONTHDT.MONTH5,DISP=SHR
.
.

For example at May 2017, I need to add a new data //M20175,
and for 2017 Jun, I will have to add another new data //M20176, so and so forth.

May I ask is that possible and how I can make it more automatic, use some loop methods or any way to make this easy?

Thank you.

Re: Please help

PostPosted: Mon Jun 19, 2017 9:51 am
by steve-myers
Do not ever post the same question in multiple forums, You will not get any answer anywhere.

Re: Please help

PostPosted: Mon Jun 19, 2017 1:41 pm
by NicC
Presumably the program that reads these new DDnames gets chnged every month so get the programmer to come up with the new JCL. Maybe then they will start to look at a proper design - maybe using GDGs.

Re: Please help

PostPosted: Mon Jun 19, 2017 4:56 pm
by Robert Sample
for each month I need to manually rewrite the code and add a new month data.
Do you mean each month you have to add code for the new DD name? If so, what language do you use, and if not, what do you mean by "manually rewrite the code"? Furthermore, have you considered using a generation data group for this? How many months back do you keep in the JCL? Do you have a sort for the data or are you processing it month-by-month? What is the precise process you follow each month? Does your site use a job scheduler and if so have you investigated the possibility of using it?

In other words, you have told us almost NOTHING about your process and hence it is pretty much impossible for us to provide you assistance.

Re: Please help

PostPosted: Mon Jun 19, 2017 9:05 pm
by GeorgeQ
Robert Sample wrote:
for each month I need to manually rewrite the code and add a new month data.
Do you mean each month you have to add code for the new DD name? If so, what language do you use, and if not, what do you mean by "manually rewrite the code"? Furthermore, have you considered using a generation data group for this? How many months back do you keep in the JCL? Do you have a sort for the data or are you processing it month-by-month? What is the precise process you follow each month? Does your site use a job scheduler and if so have you investigated the possibility of using it?

In other words, you have told us almost NOTHING about your process and hence it is pretty much impossible for us to provide you assistance.




Yes,I will run this each month, but I only need one year data(max is 12 month), so each new month I will append(this is the manually part, if current month is September ,I will add "//M20179 DD DSN=A000000.MONTHDT.MONTH9,DISP=SHR") a new DDNAME base on last month. even I use generation data I still need to add a new DDNAME(because the amount of DDNAME is increasing from (1<Jan> to 12<Dec> ). I use jcl to run SAS program.

Thanks!

Re: Please help

PostPosted: Mon Jun 19, 2017 10:15 pm
by NicC
No - you do not need to change the JCL if you use a GDG. You specify the GDG base name and that will pick up all generations. But you have to make sure that the GDG only keeps the latest 12 (one year's worth) generations so as the latest is created the oldest is deleted (or, at least, is uncatalogued).

Re: Please help

PostPosted: Mon Jun 19, 2017 10:23 pm
by Robert Sample
If you use a GDG, you have only one DD statement -- DISP=SHR,DSN=<gdg.base> will pick up all generations (as of z/OS 2.1, you can use GDGORDER in your JCL on the DD statement to select whether to retrieve generations from oldest to newest or newest to oldest which is the default). As new months are added, the old months roll off the GDG as long as the limit is set to 12. You would not need to change the SAS code for a new DD statement every month, then.

Re: Please help

PostPosted: Tue Jun 20, 2017 1:10 am
by GeorgeQ
Robert Sample wrote:If you use a GDG, you have only one DD statement -- DISP=SHR,DSN=<gdg.base> will pick up all generations (as of z/OS 2.1, you can use GDGORDER in your JCL on the DD statement to select whether to retrieve generations from oldest to newest or newest to oldest which is the default). As new months are added, the old months roll off the GDG as long as the limit is set to 12. You would not need to change the SAS code for a new DD statement every month, then.



I think only one DD statement is not enough, if this month is May, so I need five generations GDG(0),GDG(-1),GDG(-2),GDG(-3),GDG(-4)..
but next month I will need six generations, so I need add a new DDNAME for GDG(-5),this is a manually work.

Thanks!

Re: Please help

PostPosted: Tue Jun 20, 2017 1:46 am
by NicC
Yes - only one DDNAME. Specifying the gdg base and no relative or absolute generation number means that all the data sets of that gdg are concatenated together by the system. For someone who's skills include JCL you should know that. Read the manual(s).

Re: Please help

PostPosted: Tue Jun 20, 2017 3:29 am
by GeorgeQ
I don't want concatenated each generations together, I just want use each historical monthly data.
so even I use GDG data, I still need to add new DDNAME
//M20171 DD DSN=A000000.MONTHDT.MONTH(-4),,DISP=SHR
//M20172 DD DSN=A000000.MONTHDT.MONTH(-3),,DISP=SHR
//M20173 DD DSN=A000000.MONTHDT.MONTH(-2),,DISP=SHR
//M20174 DD DSN=A000000.MONTHDT.MONTH(-1),DISP=SHR
//M20175 DD DSN=A000000.MONTHDT.MONTH(0),DISP=SHR

next month I will have to modify the code as show in below. for //M20171,becasue next month //A000000.MONTHDT.MONTH(0) will become data for June instead of May.
//M20171 DD DSN=A000000.MONTHDT.MONTH(-5),,DISP=SHR
//M20172 DD DSN=A000000.MONTHDT.MONTH(-4),,DISP=SHR
//M20173 DD DSN=A000000.MONTHDT.MONTH(-3),,DISP=SHR
//M20174 DD DSN=A000000.MONTHDT.MONTH(-2),DISP=SHR
//M20175 DD DSN=A000000.MONTHDT.MONTH(-1),DISP=SHR
//M20176 DD DSN=A000000.MONTHDT.MONTH(0),DISP=SHR