Page 1 of 1

Need help regarding a JCL

PostPosted: Wed May 10, 2017 8:15 pm
by Yogi
Hi,

I wanted to create an JCL where month filed should be subtract by 1 from the current month from an input file.
Below is the format of file where date is in the format YYYYMM.

KAT2L5555555409000000KAAT88903000T111201701SAPKOR+00000000000030400

Please provide your guidance.

Re: Need help regarding a JCL

PostPosted: Wed May 10, 2017 8:22 pm
by NicC
JCL does not do that. It only tells the machine what programs you want executed, the resources those programs require and the sequence of processing.
Your JCL will depend on what program you are going to use - if a utility then the utility manual will describe the JCL required. It will also describe the utility control statements.

Re: Need help regarding a JCL

PostPosted: Wed May 10, 2017 8:50 pm
by Robert Sample
Your post is pretty much useless as far as explaining what you want. For example, what does
create an JCL where month filed should be subtract by 1 from the current month
mean? Assuming that you meant "month field" instead of "month filed" (proofreading your post before hitting the Submit button is something everyone should do), where is the month field to be used? It could be part of a data set name, or a SET parameter in a job, or a utility control statement (such as SORT or IDCAMS), or a parameter for an EXEC ... in other words, you have told us NOTHING about month field and its usage. Also, since JCL cannot be changed once it is submitted, if you want to create month field and use it in the executing job -- that CANNOT be done, period. You could create another job to submit through the internal reader, but you cannot have a created value affecting the executing job.

And, by the way, most of the time date manipulation is done through the job scheduler for production jobs. So why are you not using your site's job scheduler for this?

Re: Need help regarding a JCL

PostPosted: Thu May 11, 2017 1:54 pm
by Aki88
Hello,

Should you choose to use DFSORT or SYNCSORT (MFX) for your requirement, then you'll have to let us know which SORT your site has (DFSORT or SYNCSORT).
This can be checked by looking at the SORT step SYSOUT, if the messages start with ICE, it is DFSORT; if they start with WER, it is SYNCSORT.

Reason for asking this is, DFSORT has a quick solution for your problem, you can use the function SUBMONS provided by DFSORT to subtract months from a given date; have used it on numerous occasions in the past, and find it extremely useful, it saves a lot of code.

The site I am currently working with has SYNCSORT, I do not happen to have the updated documentation for it with me, so I cannot attest to this, but SUBMONS (at least for the version I have: SYNCSORT for z/OS 2.1.1.1N) gave me a SYNTAX ERROR when tested. In this case what you can do is, first subtract the month by using SUB function, then use IFTHEN construct to test the new month calculated so as to modify the year/century accordingly. Requires a bit of code, but doable.