separate (Tracker.Manipulate_Data)
procedure Prioritize is
    --------------------------------------------------------------------------------
    --|
    --|  NAME:  PRIORITIZE
    --|
    --|  OVERVIEW:
    --|    This procedure sorts the element lists according to milestone completion
    --|    number and then element priority.
    --|
    --|  EXCEPTIONS HANDLED:
    --|    others   an error message is printed and execution continues
    --|
    --|  HISTORY:
    --|    written by   Bonnie Burkhardt   March 1985
    --------------------------------------------------------------------------------
    use Ms_List_Pkg;
    use Pr_List_Pkg;

    Complete_Num :
       Integer range Ms_Num_Type'First .. Ms_Num_Type'Last + 1 := 100;
    End_List : Boolean := False;
    In_Sorted_List : Boolean := False;
    Lo_Ms_Ptr : Milestone_Pointer;
    Lo_Ms : Ms_Num_Type := 1;
    Hi_Ms : Ms_Num_Type := 1;
    Ms_Ptr : Milestone_Pointer;
    Ms_Ptr2 : Milestone_Pointer;
    Ms_Index : Integer := 0;
    Pr_Ptr : Personnel_Pointer;
    Sorted_Ms_List : Ms_List_Pkg.List_Type;
    Succeed : Boolean := False;

    procedure Sort_El_In_Ms is separate;
    procedure Sort_El_In_Pr is separate;

begin
    -- sort the milestone list by completion sequence number
    for Ms_Index in 1 .. Num_Of_Milestones loop
        Start_Walk (Ms_List);
        Complete_Num := 100;

        loop
            Walk (Ms_List, Ms_Ptr, End_List);
            exit when End_List;
            Find (Sorted_Ms_List, Ms_Ptr.Number, Ms_Ptr2, In_Sorted_List);

            if not In_Sorted_List and
               (Ms_Ptr.Completion_Number < Complete_Num) then
                Complete_Num := Ms_Ptr.Completion_Number;
                Lo_Ms_Ptr := Ms_Ptr;
            end if;
        end loop;

        Add (Sorted_Ms_List, Lo_Ms_Ptr.Number, Lo_Ms_Ptr);
    end loop;

    -- sort the element list for each milestone by priority number
    Start_Walk (Sorted_Ms_List);

    loop
        Walk (Sorted_Ms_List, Ms_Ptr, End_List);
        exit when End_List;
        Sort_El_In_Ms;
    end loop;

    -- sort the element list for each person according to the milestone and
    -- element lists created
    Start_Walk (Pr_List);

    loop
        Walk (Pr_List, Pr_Ptr, End_List);
        exit when End_List;
        Sort_El_In_Pr;
    end loop;

exception
    when others =>
        Put_Line ("exception raise in PRIORITIZE");
end Prioritize;


