
    /* Start Fred */
    if (Begin(ctTRNLOG|ctENABLE) == 0) {
      printf("Error beginning transaction: %d\n", uerr_cod);
    }
    AddName ("Fred", "Flintstone");
    AddPhone ("213-555-1212", "home");

    cycles = 0;

    /* Save our position in the transaction for now */
    SavePoint = SetSavePoint ();
    do {

      /* Try it */
      oops = AddAddress ("1234 Jurassic Park", "", "Bedrock", "PL", "12345", "Home");
      oops |= AddPhone ("213-555-6666", "work");
      oops |= AddPhone ("213-555-7777", "mobile");

      /* Were we sucessful? */
      if (oops) {
        /* No, go back on our transaction. */
        cycles++;

        if (cycles > 5) {
          printf ("Transaction Failed after 6 tries!");
          Abort ();             /* Stop the transaction */
          StopUser ();          /* Close out the connection */
          ctrt_exit(4);
        } else {
          RestoreSavePoint (SavePoint);
        }
      }
      
    } while (oops);

    if (Commit(ctFREE)) {
      printf("Error committing transaction: %d.\n", uerr_cod);
    }

    printf ("LatestIndex is %ld\n", LatestIndex);
    /* End Fred */
