From ee82f99ecceeaf6e69c2af4f2038f80d11847102 Mon Sep 17 00:00:00 2001 From: agibert Date: Thu, 11 Dec 2008 14:17:18 +0000 Subject: [PATCH] - Minor code changes. --- MQSLoad.java | 53 ++++++++++++++++++++++++------------------------ ReleaseNotes.txt | 9 ++++---- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/MQSLoad.java b/MQSLoad.java index 9805970..7626937 100644 --- a/MQSLoad.java +++ b/MQSLoad.java @@ -1,7 +1,7 @@ // $RCSfile: MQSLoad.java,v $ -// $Revision: 1.16 $ +// $Revision: 1.17 $ // $Name: $ -// $Date: 2008/12/09 15:01:02 $ +// $Date: 2008/12/11 14:17:18 $ // $Author: agibert $ /* @@ -35,9 +35,9 @@ import com.ibm.mq.*; public class MQSLoad { - private String MQSLoad_Revision = "$Revision: 1.16 $"; + private String MQSLoad_Revision = "$Revision: 1.17 $"; private String MQSLoad_Tag = "$Name: $"; - private String MQSLoad_Date = "$Date: 2008/12/09 15:01:02 $"; + private String MQSLoad_Date = "$Date: 2008/12/11 14:17:18 $"; private String MQSLoad_Author = "$Author: agibert $"; private MQQueueManager QMng = null; private String QMng_Name = ""; @@ -202,7 +202,7 @@ public class MQSLoad // //------------------------------------------------------------------------------------------------------------------------- - private void Arg_Parse( String args[]) throws Exception + private void Args_Parse( String args[]) throws Exception { int argc = 0; @@ -583,18 +583,18 @@ public class MQSLoad // //------------------------------------------------------------------------------------------------------------------------- - private int Msg_Put( MQMessage Output_Msg, int Msg_Id, int Msg_Nb, int Msg_Skip, int Msg_Count) throws Exception + private boolean Msg_Put( MQMessage Output_Msg, int Msg_Id, int Msg_Skip, int Msg_Count) throws Exception { if( Msg_Id < Msg_Skip) { - Counter_Print( "*"); + Counter_Print( "#"); Msg_Skiped_Nb++; } else { if( ( Msg_Count != 0) && ( Msg_Id >= ( Msg_Skip + Msg_Count))) { - Counter_Print( "#"); + Counter_Print( "*"); Msg_Skiped_Nb++; } else @@ -605,7 +605,6 @@ public class MQSLoad Counter_Print( "."); - Msg_Nb++; Msg_Read_Nb++; Stand_By( Sleep_Time); @@ -617,11 +616,11 @@ public class MQSLoad if( ( Msg_Count != 0) && ( Msg_Id >= ( Msg_Skip + Msg_Count))) { /* Last Message to be read */ - return( -1); + return( false); } else { - return( Msg_Nb); + return( true); } } @@ -643,7 +642,6 @@ public class MQSLoad int buf_size, work_win_size, break_win_size, prefetch_size, fetch_size; int cur_buf_size, cur_work_win_size, cur_pos, msg_break; int msg_id = 0; - int msg_nb = 0; try @@ -725,7 +723,7 @@ public class MQSLoad /* send the message */ // System.out.println( "* Put Msg()"); - if( ( msg_nb = Msg_Put( output_msg, msg_id, msg_nb, Msg_Skip, Msg_Count)) == -1) + if( Msg_Put( output_msg, msg_id, Msg_Skip, Msg_Count) == false) { return; } @@ -754,7 +752,7 @@ public class MQSLoad { /* flush the message */ // System.out.println( "* Put Msg()"); - Msg_Put( output_msg, msg_id, msg_nb, Msg_Skip, Msg_Count); + Msg_Put( output_msg, msg_id, Msg_Skip, Msg_Count); } return; @@ -774,7 +772,7 @@ public class MQSLoad // //------------------------------------------------------------------------------------------------------------------------- - private void Print_Usage( ) throws Exception + private void Usage_Print( ) throws Exception { System.out.println( "Usage: MQSLoad [-qm \"Output_QueueMng_Name\"] [-cs \"character_set\"] [-st \"sleep_time\"] [-fb \"field_break\"] [-mb \"message_break\"] [-mt \"message_tail\"] [-kmb] [-ms \"message_skip\"] [-mc \"message_count\"] [-rc \"repeat_count\"] "); System.out.println( " Default: Output QueueMng Name: (" + QMng_Name + ") Character Set: (" + Character_Set + ") Sleep Time: (" + Sleep_Time + ") Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Message Tail: (" + Str_UnFormat( Message_Tail) + ") Keep Message Break: (" + Keep_Message_Break + ") Message Skip: (" + Message_Skip + ") Message Count: (" + Message_Count + ") Repeat Count: (" + Repeat_Count + ")"); @@ -788,7 +786,7 @@ public class MQSLoad // //------------------------------------------------------------------------------------------------------------------------- - private void Print_Args( ) throws Exception + private void Args_Print( ) throws Exception { System.out.println( "Output QueueMng Name: (" + QMng_Name + ") Output MsgQueue Name: (" + MsgQ_Name + ") Input File Name: (" + File_Name + ")"); System.out.println( "Character Set: (" + Character_Set + ") Sleep Time: (" + Sleep_Time + ") Field Break: (" + Str_UnFormat( Field_Break) + ") Message Break: (" + Str_UnFormat( Message_Break) + ") Message Tail: (" + Str_UnFormat( Message_Tail) + ") Keep Message Break: (" + Keep_Message_Break + ") Message Skip: (" + Message_Skip + ") Message Count: (" + Message_Count + ") Repeat Count: (" + Repeat_Count + ")"); @@ -804,34 +802,37 @@ public class MQSLoad public MQSLoad( String args[]) { - int loop; - long time_begin, time_end; - double time_elapsed, speed; - NumberFormat nf = NumberFormat.getInstance(); - - + int loop; + long time_begin, time_end; + double time_elapsed, speed; + NumberFormat nf = NumberFormat.getInstance(); + RandomAccessFile input_file = null; + + try { System.out.println("MQSLoad: " + MQSLoad_Tag + " / " + MQSLoad_Date + " / " + MQSLoad_Author); if( ( args.length < 2) || ( args.length > 19)) { - Print_Usage(); + Usage_Print(); System.exit( 1); } else { System.out.println( "MQS Load Starting..."); - Arg_Parse( args); - Print_Args(); + Args_Parse( args); + Args_Print(); MQSInit(); try { - RandomAccessFile input_file = new RandomAccessFile( File_Name, "r"); + input_file = new RandomAccessFile( File_Name, "r"); + System.out.println( "Legend: .: Loaded #: Skiped"); + try { // System.out.println("Input File Open: (" + input_file + ") !"); diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 403ca3c..3ba272e 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,7 +1,7 @@ # $RCSfile: ReleaseNotes.txt,v $ -# $Revision: 1.12 $ +# $Revision: 1.13 $ # $Name: $ -# $Date: 2008/12/04 10:45:06 $ +# $Date: 2008/12/11 14:17:18 $ # $Author: agibert $ @@ -9,13 +9,14 @@ -------------------------------------------------------------------------------- -MQSLoad V 2.0.0 - A. Gibert - 2008/12/03 +MQSLoad V 2.0.0 - A. Gibert - 2008/12/11 -------------------------------------------------------------------------------- -- Major code cleanup, +- Major code rewrite and cleanup, - Add message skip option "-ms", - Add message count option "-mc", - Add repeat count option "-rc", +- Add character set option "-cs", - Fix Java 1.4 compatibility.