<< "' message with iid:" << msg . getField (F_IID)
<< "' message with iid:" << (msg . exists (F_IID) ? msg . getField (F_IID) : "NULL")
int main (int argc, char ** argv){  long int cnts = 0;                  // messages seen  long int cntc = 0;                  // messages committed  Message_t msg;                      // current message  NCode_t ncode;                      // current NCode  char act;                           // action enumeration  ifstream msgfile;                   // the message file stream  BankSet_t bnks;                     // all the banks  UniversalSet_t objs;                // all the objects  Bank_t * bp;                        // current bank  Universal_t * op;                   // current object  //-- Parse the command line arguments  ParseArgs (argc, argv);  //-- Output the current time and bank directory  cerr << "START DATE: " << Date( ) << endl;  cerr << "Bank is: " << OPT_BankName << endl;  //-- BEGIN: MAIN EXCEPTION CATCH  try {    //-- If OPT_ForceCreate, blast away existing banks    if ( OPT_ForceCreate )      for ( BankSet_t::iterator i = bnks . begin( ); i != bnks . end( ); ++ i )	if ( i -> exists (OPT_BankName) )	  {	    i -> open (OPT_BankName, B_WRITE);	    i -> destroy ( );	  }    //-- Compress RED and SEQ if option is turned on    if ( OPT_Compress )      {	((Read_t &)objs [Read_t::NCODE]) . compress( );	((Sequence_t &)objs [Sequence_t::NCODE]) . compress( );      }    //-- Open the message file    msgfile . open (OPT_MessageName . c_str( ));    msgfile . seekg (0, ios::end);    ProgressDots_t dots (msgfile . tellg( ), 50);    msgfile . seekg (0, ios::beg);    if ( ! msgfile )      AMOS_THROW_IO ("Could not open message file " + OPT_MessageName);    cerr << "0%                                            100%" << endl;    //-- Read the message file    while ( msg . read (msgfile) )      {	dots . update (msgfile . tellg( ));	//-- Increment the message counter	++ cnts;	//-- Get the message NCode and figure out the type	ncode = msg . getMessageCode( );	if ( ! objs . exists (ncode) )	  {	    cerr << endl		 << "WARNING: Unrecognized message type" << endl		 << "  unknown message type '" << Decode (ncode)		 << "', message ignored" << endl;	    continue;	  }	bp = & (bnks [ncode]);	op = & (objs [ncode]);	if ( op -> isFlagA( ) )	  continue; // skip objects missing a bank	//-- Parse the message	try {	  op -> readMessage (msg);	}	catch (const Exception_t & e) {	  cerr << endl	       << "WARNING: " << e . what( ) << endl	       << "  could not parse '" << Decode (ncode)	       << "' message with iid:" << msg . getField (F_IID)	       << ", message ignored" << endl;	  continue;	}	//-- Open the bank if necessary	try {	  if ( ! bp -> isOpen( ) )	    {	      if ( OPT_Create )		bp -> create (OPT_BankName, B_WRITE);	      else		bp -> open (OPT_BankName, B_WRITE);	    }	}	catch (const Exception_t & e) {	  cerr << endl	       << "WARNING: " << e . what( ) << endl	       << "  could not open '" << Decode (ncode)	       << "' bank, all messages ignored" << endl;	  op -> setFlagA (true);	  continue;	}	//-- Get the message action code	act = msg . exists (F_ACTION) ? msg [F_ACTION] [0] : E_ADD;	//-- Perform the appropriate action on the bank	try {	  switch (act)	    {	    case E_ADD:	      //-- Append a new object to the bank	      bp -> append (*op);	      break;	    case E_DELETE:	      //-- Flag an existing object for removal from the bank	      if ( op -> getIID( ) != NULL_ID )		bp -> remove (op -> getIID( ));	      else if ( ! op -> getEID( ) . empty( ) )		bp -> remove (op -> getEID( ) . c_str( ));	      else		AMOS_THROW_ARGUMENT ("Cannot remove object w/o IID or EID");	      break;	    case E_REPLACE:	      //-- Replace an existing object in the bank	      if ( op -> getIID( ) != NULL_ID )		bp -> replace (op -> getIID( ), *op);	      else if ( ! op -> getEID( ) . empty( ) )		bp -> replace (op -> getEID( ) . c_str( ), *op);	      else		AMOS_THROW_ARGUMENT ("Cannot replace object w/o IID or EID");	      break;	    default:	      AMOS_THROW_IO ((string)"Unrecognized action field " + act);	    }	}	catch (const IOException_t & e) {	  cerr << endl	       << "WARNING: " << e . what( ) << endl	       << "  could not commit '" << Decode (ncode)	       << "' with iid:" << msg . getField (F_IID)	       << " to bank, message ignored" << endl;	  continue;	}	catch (const ArgumentException_t & e) {	  cerr << endl	       << "WARNING: " << e . what( ) << endl	       << "  ID conflict caused by '" << Decode (ncode)	       << "' with iid:" << msg . getField (F_IID)	       << ", message ignored" << endl;	  continue;	}	cntc ++;      }    dots . end( );    msgfile . close( );    bnks . closeAll( );  }  catch (const Exception_t & e) {    cerr << endl      	 << "FATAL: " << e . what( ) << endl	 << "  could not perform transaction, abort" << endl	 << "Messages seen: " << cnts << endl	 << "Messages committed: " << cntc << endl;    return EXIT_FAILURE;  }  //-- END: MAIN EXCEPTION CATCH  //-- Output the end time  cerr << "Messages seen: " << cnts << endl       << "Messages committed: " << cntc << endl       << "END DATE:   " << Date( ) << endl;  return EXIT_SUCCESS;}