I need to split a sequential Mainframe file. Well, to be precise I need to copy the content from this file to another, starting from a specific keyword. Example:
line1
line2
line3
start line4
line5
line6
In this case I need to search for "start" and copy everything starting from line4 to another file using either REXX or SORT. Any suggestions?
EDIT: What I thought about but not happy with in REXX
"EXECIO * DISKR INPUT (STEM INPUT. FINIS)"
LINEINPUT = 1
LINEOUTPUT = 1
FOUND = 0 /*working like a boolean?
DO WHILE LINEINPUT <= INPUT.0
IF INPUT.LINEINPUT = start line4 THEN DO
FOUND = 1
END
IF FOUND = 1 THEN DO
INPUT.LINEINPUT = OUTPUT.LINEOUTPUT
LINEOUTPUT = LINEOUTPUT + 1
END
LINEINPUT = LINEINPUT + 1
END
Something like this maybe, but this means that I need to go through all those files line by line. Maybe there is a better way in JCL? Maybe Syncsort can do something like this?
RECFM is fixed. FBA to be precise. LRECL 170. The trigger can either be a part of this line or the whole line. This is not important, because it is always the same line in every single file and even the first few characters are unique in the whole file. Means that "start" only appears once in the file.