Find and Replace code help needed

I have a file "dbshot.xml" that contains lines that need replacing in a batch format but the parameters are based on two lines.

Ex.
<role roletype="01">
<status>1

needs to be changed to

<role roletype="01">
<status>0

I can't use simply "<status>1" replace since the roletype in the preceding line must be considered a precondition of changing the status.

Any help is greatly appreciated. :confused:

$ cat orgill.pl
#!/usr/bin/perl

open( FH, "./datafile" ) || die "Couldn't open file...\n";

while ( <FH> ) {
   $data .= $_;
}

$data =~ s/<role roletype="01">\n<status>1\n/<role roletype="01">\n<status>0\n/g
;

print $data;
$ ./orgill.pl > newfile

Cheers
ZB

In ksh

$ cat dbshot.xml 
<role roletype="01">
<status>1

<role roletype="02">
<status>1

blah blah
<status>1

$ cat script.sh
sed '/roletype="01"/ {
n
s/<status>1/<status>0/
}' dbshot.xml

$ script.sh
<role roletype="01">
<status>0

<role roletype="02">
<status>1

blah blah
<status>1

bjorno