I'd like to search a file (will have lots of them) for a specified string, & if found then copy that record plus the next 6 to a different file.
I'm not sure if SORT can do that, any help is appreciated, thanks
It's not clear if the searched-for text can occur more than once in the data.
You don't need an ID (unless you need an ID, if they only want the first group, for instance), just PUSH a known non-blank one-byte field (like the first of the value which indicates the group) then OMIT= for blanks there.
The GROUP is the important part, and what is missing is RECORDS=6. That will give you groups of six whether one or more key is present. SS as a field-type can find the key within a given range (start, length) on the record.
If there is no byte that can be guaranteed non-blank, can use an ID or SEQ of length one (since the value doesn't matter).
sorry, to be clearer, the files being searched contain JCL, I'm only searching for 1 string (on an EXEC statement), and there may be multiple instances of that in any 1 file, not necessarily in the same position