by BillyBoyo » Thu Jul 28, 2011 11:55 pm
Yes, enrico, that makes much more sense. I didn't get it.
If the second line of the continuation, or whatever it is that follows the "PGM=INSYNC" is also "standard", in that it is in the same position and same value, and does not occur elsewhere in the JCL, then you can use the technique you are already using, but change it to look for the different value.
If the same value, but not in fixed position you can scan.
However, you might not be that lucky. You might pick up something that is not from INSYNC if the second continuation is not unique to INSYNC.
If you have to rely on INSYNC, then you'll need a bit more jiggering about. Something like a sequence number set to 1000000 until you find INSYNC, when it can be set to 1. Then when the sequence is 3 (or two, depending on the counting) you can do your insert. Strip off the sequence numbers.
That is a broad approach. I'm sure it can be refined. Check how to define a GROUP or things like that.
I suspect you can even adjust it to do the insert after the first line which is not a continuation, though the ability to do inline comments in the JCL may cloud things.
If you show some samples of what it is you actually want, it'll help.
The more "standardised" your JCL is, the easier it is to change programatically.