Add Copy Mode (-cm).

This commit is contained in:
giberta1 2003-09-04 15:42:41 +00:00
parent bf636a2cea
commit 4bdbc1e2e1

View File

@ -1,11 +1,11 @@
// $RCSfile: MQSSave.java,v $ // $RCSfile: MQSSave.java,v $
// $Revision: 1.10 $ // $Revision: 1.11 $
// $Name: $ // $Name: $
// $Date: 2002/11/14 13:40:24 $ // $Date: 2003/09/04 15:42:41 $
// $Author: giberta1 $ // $Author: giberta1 $
/* /*
* MQSSave.java - MQ/Seires queue to data file saver * MQSSave.java - MQ/Series queue to data file saver
* Copyright (C) 2002 Arnaud G. Gibert * Copyright (C) 2002 Arnaud G. Gibert
* arnaud.gibert@misys.com * arnaud.gibert@misys.com
* www.misys.com * www.misys.com
@ -43,12 +43,13 @@ public class MQSSave
private String Output_File_Name, Flush_File_Name = "flush.txt"; private String Output_File_Name, Flush_File_Name = "flush.txt";
private String Message_Break = "\r\n"; private String Message_Break = "\r\n";
private boolean TI_Swift_Batch_Mode = false; private boolean TI_Swift_Batch_Mode = false;
private boolean Copy_Mode = false;
private boolean Trim_Mode = false; private boolean Trim_Mode = false;
private boolean MBTrailer_Mode = false; private boolean MBTrailer_Mode = false;
private int Total_Nb = 0, Moved_Nb = 0, Skiped_Nb = 0, Scaned_Nb = 0, Flushed_Nb = 0; private int Total_Nb = 0, Moved_Nb = 0, Skiped_Nb = 0, Scaned_Nb = 0, Flushed_Nb = 0;
private String MQSSave_Revision = "$Revision: 1.10 $"; private String MQSSave_Revision = "$Revision: 1.11 $";
private String MQSSave_Tag = "$Name: $"; private String MQSSave_Tag = "$Name: $";
private String MQSSave_Date = "$Date: 2002/11/14 13:40:24 $"; private String MQSSave_Date = "$Date: 2003/09/04 15:42:41 $";
private String MQSSave_Author = "$Author: giberta1 $"; private String MQSSave_Author = "$Author: giberta1 $";
@ -230,9 +231,29 @@ public class MQSSave
} }
} }
else if ( args[argc].equals( "-tisbm")) else if ( args[argc].equals( "-tisbm"))
{
if( Copy_Mode == false)
{ {
TI_Swift_Batch_Mode = true; TI_Swift_Batch_Mode = true;
} }
else
{
System.out.println( "Invalid command line option combination: -tisbm and -cm...");
throw new Exception();
}
}
else if ( args[argc].equals( "-cm"))
{
if( TI_Swift_Batch_Mode == false)
{
Copy_Mode = true;
}
else
{
System.out.println( "Invalid command line option combination: -tisbm and -cm...");
throw new Exception();
}
}
else if ( args[argc].equals( "-tm")) else if ( args[argc].equals( "-tm"))
{ {
Trim_Mode = true; Trim_Mode = true;
@ -530,8 +551,11 @@ public class MQSSave
Output_File.write( buffer_byte, 0, buffer_byte.length); Output_File.write( buffer_byte, 0, buffer_byte.length);
if( Copy_Mode == false )
{
MQSDelete_Msg( input_msg); MQSDelete_Msg( input_msg);
} }
}
else else
{ {
msg_type = input_msg.readString( MSGTYPE_LEN); msg_type = input_msg.readString( MSGTYPE_LEN);
@ -548,6 +572,7 @@ public class MQSSave
Counter_Print( Total_Nb++, '#'); Counter_Print( Total_Nb++, '#');
MQSDelete_Msg( input_msg); MQSDelete_Msg( input_msg);
first_flush = false; first_flush = false;
} }
else else
@ -757,8 +782,8 @@ public class MQSSave
if( ( args.length < 2) || ( args.length > 7)) if( ( args.length < 2) || ( args.length > 7))
{ {
System.out.println( "Usage: MQSSave [-mb \"message_break\"] [-tisbm [-ffn <Flush_File_Name>]] [-tm] [-mbtm] <Output_File_Name> <Input_MsgQueue_Name>"); System.out.println( "Usage: MQSSave [-mb \"message_break\"] [-tisbm [-ffn <Flush_File_Name>] | -cm ] [-tm] [-mbtm] <Output_File_Name> <Input_MsgQueue_Name>");
System.out.println( " Default: Message Break: (" + Str_UnFormat( Message_Break) + ") TI Swift Batch Mode: (" + TI_Swift_Batch_Mode + ") Trim Mode: (" + Trim_Mode + ") MsgBreak Trailer Mode: (" + MBTrailer_Mode + ") Flush File Name: (" + Flush_File_Name + ")"); System.out.println( " Default: Message Break: (" + Str_UnFormat( Message_Break) + ") TI Swift Batch Mode: (" + TI_Swift_Batch_Mode + ") Copy Mode: (" + Copy_Mode + ") Flush File Name: (" + Flush_File_Name + ") Trim Mode: (" + Trim_Mode + ") MsgBreak Trailer Mode: (" + MBTrailer_Mode + ")");
System.exit( 1); System.exit( 1);
} }
@ -769,7 +794,7 @@ public class MQSSave
Arg_Parse( args); Arg_Parse( args);
System.out.println( "Output File Name: (" + Output_File_Name + ") Input MsgQue Name: (" + MsgQ_Name + ") Flush File Name: (" + Flush_File_Name + ")"); System.out.println( "Output File Name: (" + Output_File_Name + ") Input MsgQue Name: (" + MsgQ_Name + ") Flush File Name: (" + Flush_File_Name + ")");
System.out.println( "Message Break: (" + Str_UnFormat( Message_Break) + ") TI Swift Batch Mode: (" + TI_Swift_Batch_Mode + ") Trim Mode: (" + Trim_Mode + ")"); System.out.println( "Message Break: (" + Str_UnFormat( Message_Break) + ") TI Swift Batch Mode: (" + TI_Swift_Batch_Mode + ") Copy Mode: (" + Copy_Mode + ") Trim Mode: (" + Trim_Mode + ") MsgBreak Trailer Mode: (" + MBTrailer_Mode + ")");
MQSInit(); MQSInit();