Parsing a txt file according to two different tags

I need to parse a txt file like below.

starts from the first occurence of

SASN2010Aber.CallEventRecord.egsnPDPRecord
{

till the last occurence of
}

in other saying name of the part(header) is SASN2010Aber.CallEventRecord.egsnPDPRecord and the content of the header is in two parenthesis {} , untill the next header.

How can I parse and separate these headers including content?

text file is below;

SASN2010Aber.CallEventRecord.egsnPDPRecord
{
    recordType : '70'D
    chargingID : '306457009'D
    sgsnAddress
    {
        Address : 'FBDC'H
    }
    pdpType : 'F121'H
    dynamicAddressFlag : '1'D
    listOfTrafficVolumes
    {
        [0]
        {
            changeTime : '1412031353342B0200'H
        }
    }
    duration : '0'D
    causeForRecClosing : '0'D
    recordSequenceNumber : '1'D
    rATType : '1'D
    listOfServiceData
    {
        [0]
        {
            ratingGroup : '4'D
            resultCode : '4010'D
            timeUsage : '0'D
            timeOfReport : '1412031353342B0200'H
            failureHandlingContinue : '0'D
            serviceIdentifier : '404'D
        }
    }
}

SASN2010Aber.CallEventRecord.egsnPDPRecord
{
    recordType : '70'D
    chargingID : '306457009'D
    sgsnAddress
    {
        Address : 'FBDC'H
    }
    pdpType : 'F121'H
    dynamicAddressFlag : '1'D
    listOfTrafficVolumes
    {
        [0]
        {
            changeTime : '1412031353342B0200'H
        }
    }
    causeForRecClosing : '0'D
    rATType : '1'D
    listOfServiceData
    {
        [0]
        {
            ratingGroup : '4'D
            resultCode : '4010'D
            failureHandlingContinue : '0'D
            serviceIdentifier : '404'D
        }
        [1]
        {
            ratingGroup : '4'D
            resultCode : '4010'D
            failureHandlingContinue : '0'D
            serviceIdentifier : '404'D
        }

    }
}

SASN2010Aber.CallEventRecord.egsnPDPRecord
{
    sgsnAddress
    {
        Address : 'FBDC'H
    }
    pdpType : 'F121'H
    listOfTrafficVolumes
    {
        [0]
        {
            changeTime : '1412031353342B0200'H
        }
    }
    duration : '0'D
    listOfServiceData
    {
        [3]
        {
            ratingGroup : '4'D
            resultCode : '4010'D
            timeUsage : '0'D
            serviceIdentifier : '404'D
        }
    }
}

the output need to be like below (3 divided);

SASN2010Aber.CallEventRecord.egsnPDPRecord
{
.
.
.
.
.
.
}
SASN2010Aber.CallEventRecord.egsnPDPRecord
{
.
.
.
.
.
.
}
SASN2010Aber.CallEventRecord.egsnPDPRecord
{
.
.
.
.
.
.
}

Any attempts from your side?

There are three separated records with that name in your sample file. So - what exactly do you want to achieve?

---------- Post updated at 14:19 ---------- Previous update was at 14:17 ----------

And, what's the "two different tags" in the thread header?

If you want to parse matching {} you will need a parsing algorithm using a stack. On the other hand if you rely on nice formatting so you just want to extract stuff between curly braces found in the first column things are easier. The following perl script for example will split the input into several output files:

#!/usr/bin/perl

my $nr=0;
my $fh=undef;

while (<>) 
{ if ( m/^{/ )
  { open($fh, ">", "output" . $nr) or die "Can't open output file !";
  }
  elsif ( m/^}/ )
  { close($fh);
    $fh = undef;
    $nr++;
  }
  elsif ($fh)
  { print $fh $_;
  }
}

I know title is little bit wrong. I thought one was

SASN2010Aber.CallEventRecord.egsnPDPRecord
{

other one was

}

Actually there is just one and it is

SASN2010Aber.CallEventRecord.egsnPDPRecord

---------- Post updated at 10:11 AM ---------- Previous update was at 09:33 AM ----------

@Walter, thanks for your help. It works great.
There just two minor detail.

1- Can it keep the original format in the output files (I mean wiht header and parenthesis)

SASN2010Aber.CallEventRecord.egsnPDPRecord
{
.
.
.
.
.
.
}

2- Can it seperate if input includes a specific line like

ratingGroup : '4'D

?

thanks a lot. Your perl script will help me a lot even with this version.

---------- Post updated at 11:17 AM ---------- Previous update was at 10:11 AM ----------

ok, it's done in another way
thanks a lot