Joined: 25 Aug 2010 Posts: 10 Location: Bangalore, India
Actaully there is a job which runs yearly once. The program which runs in this job will delete some records from database for the year passed from the input file. Input file is hardcoded manually once. So I want to change the jcl in such a way that it should be able to increment the year each time it runs successfully in the input file passed. Please let me know how to do this.
Joined: 06 Jun 2008 Posts: 8166 Location: East Dubuque, Illinois, USA
Change the program code so if no year is input, it uses the current (or previous -- whatever works for your job) year based on the system date.
JCL executes programs -- and that is all it does. You cannot create JCL to automatically increment a variable in a file because JCL cannot do that. You could do that with a job scheduler, or you can change the program, but as you stated your request it cannot be done.
With PTF UK90025 for z/OS DFSORT V1R10 and PTF UK90026 for z/OS DFSORT V1R12(Oct, 2010), DFSORT now supports date arithmetic which can add/subtract days, months or years to a given date like shown below.