First, find the JCL and load it into some array (stem) variable.
Then the simplest procedure would be:
- Take a line.
- Does it start with '//' and is the second word (use function Word) equal to 'DD'? Then it is a dd statement, go on. Else ignore this line.
- The text between '//' and 'DD', minus blanks, is the DDname.
- Search the line for a 'DSN=' string (function Pos). If found, the text behind it up to the first comma or space is the dataset name. Use Substr function and a loop to go through the line.
When this works:
- Handle line continuations.
- Handle symbols (&something) in the JCL.
Hope this helps.