Hey Peter,
With a small modification here my code also works... 
But I have very important doubts to be cleared.....
Here is the code...
{
max=11;
line=substr($0,0,max) ;
firstcol=substr(line,0,3) ;
secondcol=substr(line,5,3);
thirdcol=substr(line,9,1)
if ( firstcol != field1 || secondcol != field2 )
{ print firstcol "," secondcol "," thirdcol; field1=firstcol; field2=secondcol }
}
And I executed it as awk -f cmp_rec test.dat > log
Ofcourse, i can execute it as u said too....
First let me clarify with you whether my understanding is right...
it is col to col comparison right??
for example,
aaa|bbb|1
aaa|bbb|2 would give me aaa|bbb|1
xxx|yyy|3 xxx|yyy|3
xxx|yyy|4 zzz|rrr|5
zzz|rrr|5
Bcos it compares aaa and bbb of the first row and the aaa and bbb of the second row...
if the first col and the second col of the first row is not equal to the first and second col of the second row, then that first instance is printed..
Now coming to the doubt,
In the above code why shoud i assign
field1=firstcol; field2=secondcol
Are these field1 and field2 key fields???? meaning system defined..???
Can you explain???
Thanks,
Nisha