compile function key_sort( Ids, Table, SortList, Cursor, MsgFlag, MsgText ) begin condition pre: post: end condition declare subroutine make.list declare function msg $insert logical $insert msg_equates open Table to TableVar else MsgInfo = '' MsgInfo = -2 MsgInfo = -2 MsgInfo = 'Unable to open ':Table:'...' Void = msg( '', MsgInfo ) return 0 end open 'DICT.':Table to DictVar else MsgInfo = '' MsgInfo = -2 MsgInfo = -2 MsgInfo = 'Unable to open dict.':Table:'...' Void = msg( '', MsgInfo ) return 0 end if not( assigned( MsgFlag ) ) then MsgFlag = '' end if not( assigned( MsgText ) ) then MsgText = '' end TmpCursor = Cursor TmpKeyList = '' clearselect TmpCursor if Ids then make.list ( TmpCursor, Ids, TableVar, DictVar ) end if MsgFlag then if MsgText else MsgText = 'Sorting...' end *msg( MsgText, 'UB', ScrImg, '' ) *call window and do process end else select Table by SortList using TmpCursor then Eof = false$ loop readnext TheKey using TmpCursor by AT then TmpKeyList<-1> = TheKey end else Eof = true$ end until Eof repeat end else MsgInfo = '' MsgInfo = -2 MsgInfo = -2 MsgInfo = 'Unable to select ':Table:' by ':SortList:'...' *Void = msg( '', MsgInfo ) return 0 end clearselect TmpCursor return TmpKeyList end