- Minor code changes.

This commit is contained in:
agibert 2008-12-11 14:17:18 +00:00
parent ffb13ee948
commit ee82f99ecc
2 changed files with 32 additions and 30 deletions

View File

@ -1,7 +1,7 @@
// $RCSfile: MQSLoad.java,v $ // $RCSfile: MQSLoad.java,v $
// $Revision: 1.16 $ // $Revision: 1.17 $
// $Name: $ // $Name: $
// $Date: 2008/12/09 15:01:02 $ // $Date: 2008/12/11 14:17:18 $
// $Author: agibert $ // $Author: agibert $
/* /*
@ -35,9 +35,9 @@ import com.ibm.mq.*;
public class MQSLoad 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_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 String MQSLoad_Author = "$Author: agibert $";
private MQQueueManager QMng = null; private MQQueueManager QMng = null;
private String QMng_Name = ""; 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; 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) if( Msg_Id < Msg_Skip)
{ {
Counter_Print( "*"); Counter_Print( "#");
Msg_Skiped_Nb++; Msg_Skiped_Nb++;
} }
else else
{ {
if( ( Msg_Count != 0) && ( Msg_Id >= ( Msg_Skip + Msg_Count))) if( ( Msg_Count != 0) && ( Msg_Id >= ( Msg_Skip + Msg_Count)))
{ {
Counter_Print( "#"); Counter_Print( "*");
Msg_Skiped_Nb++; Msg_Skiped_Nb++;
} }
else else
@ -605,7 +605,6 @@ public class MQSLoad
Counter_Print( "."); Counter_Print( ".");
Msg_Nb++;
Msg_Read_Nb++; Msg_Read_Nb++;
Stand_By( Sleep_Time); Stand_By( Sleep_Time);
@ -617,11 +616,11 @@ public class MQSLoad
if( ( Msg_Count != 0) && ( Msg_Id >= ( Msg_Skip + Msg_Count))) if( ( Msg_Count != 0) && ( Msg_Id >= ( Msg_Skip + Msg_Count)))
{ {
/* Last Message to be read */ /* Last Message to be read */
return( -1); return( false);
} }
else 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 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 cur_buf_size, cur_work_win_size, cur_pos, msg_break;
int msg_id = 0; int msg_id = 0;
int msg_nb = 0;
try try
@ -725,7 +723,7 @@ public class MQSLoad
/* send the message */ /* send the message */
// System.out.println( "* Put Msg()"); // 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; return;
} }
@ -754,7 +752,7 @@ public class MQSLoad
{ {
/* flush the message */ /* flush the message */
// System.out.println( "* Put Msg()"); // 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; 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\"] <Output_MsgQueue_Name> <Input_File_Name>"); 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\"] <Output_MsgQueue_Name> <Input_File_Name>");
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 + ")"); 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( "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 + ")"); 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[]) public MQSLoad( String args[])
{ {
int loop; int loop;
long time_begin, time_end; long time_begin, time_end;
double time_elapsed, speed; double time_elapsed, speed;
NumberFormat nf = NumberFormat.getInstance(); NumberFormat nf = NumberFormat.getInstance();
RandomAccessFile input_file = null;
try try
{ {
System.out.println("MQSLoad: " + MQSLoad_Tag + " / " + MQSLoad_Date + " / " + MQSLoad_Author); System.out.println("MQSLoad: " + MQSLoad_Tag + " / " + MQSLoad_Date + " / " + MQSLoad_Author);
if( ( args.length < 2) || ( args.length > 19)) if( ( args.length < 2) || ( args.length > 19))
{ {
Print_Usage(); Usage_Print();
System.exit( 1); System.exit( 1);
} }
else else
{ {
System.out.println( "MQS Load Starting..."); System.out.println( "MQS Load Starting...");
Arg_Parse( args); Args_Parse( args);
Print_Args(); Args_Print();
MQSInit(); MQSInit();
try try
{ {
RandomAccessFile input_file = new RandomAccessFile( File_Name, "r"); input_file = new RandomAccessFile( File_Name, "r");
System.out.println( "Legend: .: Loaded #: Skiped");
try try
{ {
// System.out.println("Input File Open: (" + input_file + ") !"); // System.out.println("Input File Open: (" + input_file + ") !");

View File

@ -1,7 +1,7 @@
# $RCSfile: ReleaseNotes.txt,v $ # $RCSfile: ReleaseNotes.txt,v $
# $Revision: 1.12 $ # $Revision: 1.13 $
# $Name: $ # $Name: $
# $Date: 2008/12/04 10:45:06 $ # $Date: 2008/12/11 14:17:18 $
# $Author: agibert $ # $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 skip option "-ms",
- Add message count option "-mc", - Add message count option "-mc",
- Add repeat count option "-rc", - Add repeat count option "-rc",
- Add character set option "-cs",
- Fix Java 1.4 compatibility. - Fix Java 1.4 compatibility.