function toIS4C($mode, $member, $updated)
{
    global $is4cOps;
    global $debug;
    global $dryRun;
    global $is4cTableNames;
    global $dieMail;
    if ($debug) {
        $ans = readline("In toIS4C mode: {$mode} {$member} > ");
    }
    // debug=2 allows inserts and updates while displaying messages.
    //$debug = 2;
    if ($dryRun) {
        echo "Bailing on dryRun.";
        return True;
    }
    // Get all the data from Civi for this member.
    // You don't know contact_id at this point.
    $row = selectCivi($member);
    if ($mode == "insert") {
        foreach ($is4cTableNames as $table) {
            $is4cOps["{$table}"] = "insert";
        }
    } else {
        // Note which IS4C operations will be inserts, which updates.
        // Find out whether the operation to each table will be insert or update.
        $is4cOps = searchIS4C2($member);
        if (preg_match("/^Error/", $is4cOps[0][0])) {
            dieHere("{$is4cOps[0][0]}", $dieMail);
        }
    }
    // Populate the local arrays
    // and create the DML statements.
    assignLocalI($row, $is4cOps, $updated);
    if ($debug) {
        goOrDie("Before DML for member: {$member} debug: {$debug}");
        1;
    }
    // Make the changes to IS4C tables.
    $resultString = insertToIS4C($mode);
    if ($resultString != "OK") {
        dieHere("{$resultString}", $dieMail);
    }
    // Important to update after insert so custdata.LastChange is last thing assigned.
    // Important to update custdata if any related table is inserted or updated.
    $resultString = updateIS4C($mode);
    if ($resultString != "OK") {
        dieHere("{$resultString}", $dieMail);
    }
    if ($debug) {
        goOrDie("After DML for member: {$member} ");
    }
    // Clear for next operation.
    //  Better to do at start.
    // Each IS4C table is represented by an assoc array.
    clearIs4cWorkVars();
    $is4cOps = array();
    // Is the clearing needed?
    return True;
    // toIS4C()
}
     // A: braces are needed.
     dieHere("{$customers[0][0]}");
 }
 // Decide where the operation to each IS4C table will be update or insert.
 //  There is another test of whether there is anything to add/change.
 $is4cOp = array();
 if (count($customers) == 0) {
     $is4cOp1 = "insert";
     foreach ($is4cTableNames as $table) {
         $is4cOp["{$table}"] = "insert";
     }
     $insertCount++;
 } else {
     $is4cOp1 = "update";
     // Find out wether the operation to each table will be insert or update.
     $is4cOp = searchIS4C2($custdata[CardNo]);
     if (preg_match("/^Error/", $is4cOp[0][0])) {
         dieHere("{$is4cOp[0][0]}");
     }
     $updateCount++;
 }
 // This lets autoincrement do its thing.
 $custdata[id] = "";
 // Fields that are the same for all.
 $custdata[CashBack] = 999.99;
 // double
 $custdata[Type] = "PC";
 $custdata[memType] = $row[mti];
 // int
 // See if the record is for more than one person.
 $isMultiple = 0;