From 4bdbc1e2e148f0e65952b0841477738b894bad8e Mon Sep 17 00:00:00 2001 From: giberta1 Date: Thu, 4 Sep 2003 15:42:41 +0000 Subject: [PATCH] Add Copy Mode (-cm). --- MQSSave.java | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/MQSSave.java b/MQSSave.java index 55a5b58..c9d9e9d 100644 --- a/MQSSave.java +++ b/MQSSave.java @@ -1,11 +1,11 @@ // $RCSfile: MQSSave.java,v $ -// $Revision: 1.10 $ +// $Revision: 1.11 $ // $Name: $ -// $Date: 2002/11/14 13:40:24 $ +// $Date: 2003/09/04 15:42:41 $ // $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 * arnaud.gibert@misys.com * www.misys.com @@ -43,12 +43,13 @@ public class MQSSave private String Output_File_Name, Flush_File_Name = "flush.txt"; private String Message_Break = "\r\n"; private boolean TI_Swift_Batch_Mode = false; + private boolean Copy_Mode = false; private boolean Trim_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 String MQSSave_Revision = "$Revision: 1.10 $"; + private String MQSSave_Revision = "$Revision: 1.11 $"; 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 $"; @@ -231,7 +232,27 @@ public class MQSSave } else if ( args[argc].equals( "-tisbm")) { - TI_Swift_Batch_Mode = true; + if( Copy_Mode == false) + { + 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")) { @@ -530,7 +551,10 @@ public class MQSSave Output_File.write( buffer_byte, 0, buffer_byte.length); - MQSDelete_Msg( input_msg); + if( Copy_Mode == false ) + { + MQSDelete_Msg( input_msg); + } } else { @@ -548,6 +572,7 @@ public class MQSSave Counter_Print( Total_Nb++, '#'); MQSDelete_Msg( input_msg); + first_flush = false; } else @@ -703,7 +728,7 @@ public class MQSSave Output_File.write( buffer_byte, 0, buffer_byte.length); - MQSDelete_Msg( input_msg); + MQSDelete_Msg( input_msg); } else { @@ -757,8 +782,8 @@ public class MQSSave if( ( args.length < 2) || ( args.length > 7)) { - System.out.println( "Usage: MQSSave [-mb \"message_break\"] [-tisbm [-ffn ]] [-tm] [-mbtm] "); - 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( "Usage: MQSSave [-mb \"message_break\"] [-tisbm [-ffn ] | -cm ] [-tm] [-mbtm] "); + 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); } @@ -769,7 +794,7 @@ public class MQSSave 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( "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();