As has been mentioned, twice, the heading that you want to change has already been read and written to the output file by the time your detail line arrives and you do the test.
You seem to have a report with two types of errors, Acceptable and Not.
Do you want both types of error in the same report? If so, decide on a heading for the report.
If you don't want to mix the two types of error on the same report, split into two reports each with a correct heading.
Best place to do it, either way, is where the report was created originally. If you are stuck having to take an existing report, then say exactly what you want (mix of data? one heading only, or one per page?) Etc.
Once you explain your requirement exactly, you'll probably get something useful.
I had to use the existing report, which will have both the errors acceptable or not. I want to know, if it is possible to change the REPORT line to 'ACCEPTABLE ERRORS FOUND' / 'ERRORS FOUND' based on the status of the record.
If either is not possible then I have to think of making some changes in the way existing report is produced.
My thought is, you are going to end up with a report with a mixture of headings, and pages with a mixture of data of different statuses.
If you want it this way, it is possible with SORT. The experts will be in later, but they are on West Coast time. You need to get your requirement stated as clearly as possible. If this is the full thing, OK, but it is going to look a mess (my opinion).
Your heading can be used to define a "group" of records (from the heading to the next heading/eof). While processing the group you can check for your status. If you have blank lines, you might have some troubles looking for blanks for status, another reason I suggested going for "ERROR". If you find there is an ERROR set a status to say so. When processing the group, test the status and set overlay the heading if it says so.
Actual details I'll have to leave you to search the DFSORT forum for/consult the manual, but it certainly can be done.
As I say, get your requirement as clear as spring-water and you'll probably have a neat solution by tommorow morning.