Hi Nadya,
For me the algorithm seems OK, but I'm not sure you are writting sorted data in the right place
My comments are bellow
>scan for Flag='D'
* you had just moved on the recors with new map15 value
* but later you are using lnRecno to position your record pointer in Update_File
* if you are on the record with new map15
* you will not update your lately procceded map15,
* but that new one
* may you have to move that assignments to the end of scan
* after endif (or if always you first record contains Ass1<>0
* you may move this code in your
* if map15<>m.lcMap construction> if Ass1<> 0
> lnRecno = recno()
> endif
>
> if map15<>m.lcMap
> if m.llAllow
> goto m.lnRecno in Update_File
> ...........
* if always you first record contains Ass1<>0
* you may move this code here> else
> ...........
> endif
* may be this is better place for you lnRecno assignment>endscan
>
>
Venelina Jordanova
Outsourcing IT Services Ltd.