Print block of lines matching a pattern

Hi :),
I am using the script to search "MYPATTERN" in MYFILE and print that block of lines containing the pattern starting with HEADER upto FOOTER.
But my problem is that at some occurrence my footer is different e.g. ";". How to modify the script so that MYPATTERN between HEADER and different footers can be printed and that too without loosing the sequence.

gawk -v search='MYPATTERN' '
/HEADER/,/FOOTER/ {
block = (block ? block ORS : "") $0;
}
/FOOTER/ {
if (block ~ search)
print block;
block = "";
} ' <MYFILE>

Also, in this script what to modify if I want to print all thing except MYPATTERN blocks.

Please help me in solving this problem.

Thnx in advance.

Dear Friends,
Please help me out of this problem...