I have two files and I would like to seach them and sort them in any order. My two data files are cust.dat and order.dat.
Code:
Cust.dat contains:

CustomerId 
CustomerFirstName
CustomerMiddleName
CustomerLastName
CustomerAddress
CityStateZip
CustomerPhoneNo
CustomerEmailAddress

order.dat contains:

orderId
width
length
CarpetCharge
discount



int NotFound = 0;
While((k < NUM_OF_CUSTOMERS) && (NotFound ==1))
   {
     if ( searchKey ==custRec[key]customerId)
       {
         NotFound = 0;
       }
     if ( searchKey ==orderRec[key]orderId)
       {
         NotFound = 0;
       }
        K++;
    }
How would I go about sorting it into the fields say CustomerFirstName or by TotalBill?
Thanks for any help you can provide.