Hello,
Look up PARSE function of DFSORT in the 'DFSORT Application Programming Guide'.
Few assumptions before the solution, since you have not specified the length of the 'number' that can appear before 'FOR', I have assumed that there can be 50 characters at maximum before 'FOR' appears. Next, you have not specified if the input file is fixed length or variable, I have assumed it to be of fixed length. You have not shown the expected output, I have assumed that the output looks something as below:
Expected output:
2895
82374
68657
896
251
34772
32534
118582
230569
3031
A quick and dirty solution:
SORT FIELDS=COPY
INREC PARSE=(%01=(ENDBEFR=C'FOR',FIXLEN=50)),
BUILD=(1:%01)
Hth.