And this one.
And our old friend IEFBR14, which can be used to delete files no longer required, or to catalog a new file for output in a later step in the job. IEFBR14 doesn't read or write any files.
Dataset names are often "parameterised" in the input JCL.
What about temporary datasets, with PASS? Or sort work files or suchlike?
What about any GDGs you might have?
What about a job which defines a VSAM file, or builds an alternate index or whatever, using IDCAMS? Somewhere else in the JCL those files will almost certainly be used, but you'd be missing relevant information if you didn't look at the IDCAMS, or any other utility mentioning files in its input data but not mentioned in the JCL itself for that step.
You want to know to do the work when the job has completed successfully. How are you going to do that? For some jobs a non-zero return code might be a success.
What about conditional execution of a step? Either with COND or with IF?
I'm sure we could come up with a whole pile of other things as well.
To carry out your task on the "JCL" that is some member of a PDS would require at the very least re-writing (correctly) exactly what happens when the JCL is processed prior to entering the job queue.
Then you'd also have to look at all parameters to utilities used as well (which might be "instream" or might be a member of a PDS, or even on a plain flat file, I suppose).
Maybe you could "simplify" this by looking at the outputs. Not only the JCL output (which is still a complex thing to do) but also the outputs from any utilities. Then you still have to struggle with the definition of "successful". Do you also want to deal with something like "not catlgd 2/4"? That means going through the messages as well.
Is your JCL documented in a Data Dictionary?
Do you have some "Storage Team" or "Data Administrator" at your site? I assume yes, and I suggest you talk to them to see what they already have, or might be able to provide for you. But don't ask them the way you asked here. Tell them what you are trying to achieve. If you get something useful from them, and you still have some further work to do, come back here and explain clearly what you hope to achieve and the problems that you have encountered in attempting it.
I have no idea what you mean by the following.
Basically i want to keep [...] track of the datasets after the successful run of that JCL
In general they don't tend to move around such that they'd need tracking. I suppose they might be archived, or they might be brutally deleted if you put them on the wrong disk, but in general they'll be where you left them.