Compare commits
17 Commits
mqssave-1_
...
mqssave-1_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67d8b5f6c4 | ||
|
|
4bdbc1e2e1 | ||
|
|
bf636a2cea | ||
|
|
00a78ea920 | ||
|
|
675a925c00 | ||
|
|
33b67fe311 | ||
|
|
9174e00abe | ||
|
|
f390c41e76 | ||
|
|
e807001586 | ||
|
|
b3f10a6962 | ||
|
|
49d568238e | ||
|
|
a4bb9a9f1b | ||
|
|
781932ee0c | ||
|
|
930b2f46cc | ||
|
|
e1bb79cd46 | ||
|
|
66eb71a01d | ||
|
|
55976ffe03 |
500
MQSSave.java
500
MQSSave.java
@@ -1,13 +1,11 @@
|
|||||||
// $RCSfile: MQSSave.java,v $
|
// $RCSfile: MQSSave.java,v $
|
||||||
// $Revision: 1.2 $
|
// $Revision: 1.11 $
|
||||||
// $Name: $
|
// $Name: $
|
||||||
// $Date: 2002/04/23 14:41:38 $
|
// $Date: 2003/09/04 15:42:41 $
|
||||||
// $Author: giberta1 $
|
// $Author: giberta1 $
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 07/12/2001 - 11:45:14
|
* MQSSave.java - MQ/Series queue to data file saver
|
||||||
*
|
|
||||||
* MQSSave.java - MQ/Seires 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
|
||||||
@@ -37,14 +35,24 @@ import java.text.*;
|
|||||||
|
|
||||||
public class MQSSave
|
public class MQSSave
|
||||||
{
|
{
|
||||||
private MQQueueManager QMng;
|
private MQQueueManager QMng = null;
|
||||||
private String QMng_Name = "";
|
private String QMng_Name = "";
|
||||||
private MQQueue MsgQ;
|
private MQQueue MsgQ;
|
||||||
private String MsgQ_Name;
|
private String MsgQ_Name;
|
||||||
private int MsgQ_Open_Options = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_BROWSE | MQC.MQOO_INQUIRE;
|
private int MsgQ_Open_Options = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_BROWSE | MQC.MQOO_INQUIRE;
|
||||||
private String File_Name;
|
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 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.11 $";
|
||||||
|
private String MQSSave_Tag = "$Name: $";
|
||||||
|
private String MQSSave_Date = "$Date: 2003/09/04 15:42:41 $";
|
||||||
|
private String MQSSave_Author = "$Author: giberta1 $";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -210,9 +218,53 @@ public class MQSSave
|
|||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( args[argc].equals( "-ffn"))
|
||||||
|
{
|
||||||
|
if( argc < ( args.length + 1))
|
||||||
|
{
|
||||||
|
Flush_File_Name = args[++argc];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println( "Invalid number of command line options...");
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( args[argc].equals( "-tisbm"))
|
||||||
|
{
|
||||||
|
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"))
|
||||||
|
{
|
||||||
|
Trim_Mode = true;
|
||||||
|
}
|
||||||
|
else if ( args[argc].equals( "-mbtm"))
|
||||||
|
{
|
||||||
|
MBTrailer_Mode = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File_Name = args[argc++];
|
Output_File_Name = args[argc++];
|
||||||
MsgQ_Name = args[argc++];
|
MsgQ_Name = args[argc++];
|
||||||
|
|
||||||
if( argc < args.length)
|
if( argc < args.length)
|
||||||
@@ -242,21 +294,35 @@ public class MQSSave
|
|||||||
|
|
||||||
private void MQSInit() throws Exception
|
private void MQSInit() throws Exception
|
||||||
{
|
{
|
||||||
try
|
short retry = 0;
|
||||||
{
|
final short RETRY_MAX = 10;
|
||||||
QMng = new MQQueueManager( QMng_Name);
|
|
||||||
// System.out.println( "QManager Open: (" + QMng + ") !");
|
|
||||||
}
|
while( QMng == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QMng = new MQQueueManager( QMng_Name);
|
||||||
|
// System.out.println( "QManager Open: (" + QMng + ") !");
|
||||||
|
}
|
||||||
|
|
||||||
catch( Exception Expt)
|
catch( Exception Expt)
|
||||||
{
|
{
|
||||||
throw Expt;
|
System.out.print("!");
|
||||||
|
|
||||||
|
if( retry++ > RETRY_MAX)
|
||||||
|
{
|
||||||
|
throw Expt;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MsgQ = QMng.accessQueue( MsgQ_Name, MsgQ_Open_Options, null, null, null);
|
MsgQ = QMng.accessQueue( MsgQ_Name, MsgQ_Open_Options, null, null, null);
|
||||||
// System.out.println( "MsgQ Open: (" + MsgQ + ") !");
|
// System.out.println( "MsgQ Open: (" + MsgQ + ") !");
|
||||||
|
|
||||||
|
MQException.log = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch( Exception Expt)
|
catch( Exception Expt)
|
||||||
@@ -300,28 +366,40 @@ public class MQSSave
|
|||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
private MQMessage MQSGet_Msg( MQMessage Msg) throws Exception
|
private MQMessage MQSGet_Msg( MQMessage Msg, boolean First) throws Exception
|
||||||
{
|
{
|
||||||
MQGetMessageOptions gmo = new MQGetMessageOptions();
|
MQGetMessageOptions gmo = new MQGetMessageOptions();
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( MsgQ.getCurrentDepth() > 0)
|
if( First)
|
||||||
{
|
{
|
||||||
gmo.options = MQC.MQGMO_NO_WAIT | MQC.MQGMO_BROWSE_FIRST | MQC.MQGMO_CONVERT;
|
gmo.options = MQC.MQGMO_NO_WAIT | MQC.MQGMO_BROWSE_FIRST | MQC.MQGMO_CONVERT;
|
||||||
gmo.matchOptions = MQC.MQMO_NONE;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gmo.options = MQC.MQGMO_NO_WAIT | MQC.MQGMO_BROWSE_NEXT | MQC.MQGMO_CONVERT;
|
||||||
|
}
|
||||||
|
|
||||||
|
gmo.matchOptions = MQC.MQMO_NONE;
|
||||||
|
|
||||||
MsgQ.get( Msg, gmo);
|
MsgQ.get( Msg, gmo);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Msg = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return( Msg);
|
return( Msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
catch( MQException Expt)
|
||||||
|
{
|
||||||
|
if( ( Expt.completionCode != 2) || (Expt.reasonCode != 2033))
|
||||||
|
{
|
||||||
|
//System.out.println("Exception: (" + Expt + ") !!!");
|
||||||
|
throw Expt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( null);
|
||||||
|
}
|
||||||
|
|
||||||
catch( Exception Expt)
|
catch( Exception Expt)
|
||||||
{
|
{
|
||||||
//System.out.println("Exception: (" + Expt + ") !!!");
|
//System.out.println("Exception: (" + Expt + ") !!!");
|
||||||
@@ -364,7 +442,7 @@ public class MQSSave
|
|||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
private void Counter_Print( int Msg_Nb)
|
private void Counter_Print( int Msg_Nb, char Mark)
|
||||||
{
|
{
|
||||||
if( ( Msg_Nb % 50) == 0)
|
if( ( Msg_Nb % 50) == 0)
|
||||||
{
|
{
|
||||||
@@ -376,7 +454,34 @@ public class MQSSave
|
|||||||
System.out.print( " ");
|
System.out.print( " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.print( ".");
|
System.out.print( Mark);
|
||||||
|
|
||||||
|
switch( Mark)
|
||||||
|
{
|
||||||
|
case '.':
|
||||||
|
{
|
||||||
|
Moved_Nb++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case '*':
|
||||||
|
{
|
||||||
|
Flushed_Nb++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case '#':
|
||||||
|
{
|
||||||
|
Skiped_Nb++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case '~':
|
||||||
|
{
|
||||||
|
Scaned_Nb++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -387,44 +492,265 @@ public class MQSSave
|
|||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
private int Save_File( BufferedOutputStream Output_File) throws Exception
|
private void Save_File( BufferedOutputStream Output_File, BufferedOutputStream Flush_File) throws Exception
|
||||||
{
|
{
|
||||||
int msg_nb = 0;
|
MQMessage input_msg = new MQMessage();
|
||||||
MQMessage input_msg = new MQMessage();
|
byte[] buffer_byte;
|
||||||
byte[] buffer_byte;
|
short mode;
|
||||||
|
final short MODE_FLUSH = 0;
|
||||||
|
final short MODE_SCAN = 1;
|
||||||
|
final short MODE_MOVE = 2;
|
||||||
|
final short MODE_FULLMOVE = 3;
|
||||||
|
final short MSGTYPE_LEN = 10, FILLER_LEN = 128;
|
||||||
|
String msg_type;
|
||||||
|
final String TYPE_SWIFTBEGIN = "SWIFTBEGIN";
|
||||||
|
final String TYPE_SWIFTEND = "SWIFTEND ";
|
||||||
|
final String TYPE_SWIFTERROR = "SWIFTERROR";
|
||||||
|
final String TYPE_SWIFTOUT = "SWIFTOUT ";
|
||||||
|
boolean get_first = false;
|
||||||
|
boolean first_flush = true;
|
||||||
|
boolean first_scan = true;
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
input_msg.format = MQC.MQFMT_STRING;
|
input_msg.format = MQC.MQFMT_STRING;
|
||||||
|
|
||||||
|
if( TI_Swift_Batch_Mode)
|
||||||
|
{
|
||||||
|
mode = MODE_SCAN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mode = MODE_FULLMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
input_msg = MQSGet_Msg( input_msg);
|
input_msg = MQSGet_Msg( input_msg, get_first);
|
||||||
|
|
||||||
if( input_msg != null)
|
if( input_msg != null)
|
||||||
{
|
{
|
||||||
Counter_Print( msg_nb++);
|
if( mode == MODE_FULLMOVE)
|
||||||
|
{
|
||||||
|
Counter_Print( Total_Nb++, '.');
|
||||||
|
|
||||||
if( msg_nb > 1)
|
if( Moved_Nb > 1)
|
||||||
{
|
{
|
||||||
Output_File.write( Message_Break.getBytes());
|
Output_File.write( Message_Break.getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_byte = new byte[ input_msg.getMessageLength()];
|
buffer_byte = new byte[ input_msg.getMessageLength()];
|
||||||
input_msg.readFully( buffer_byte);
|
input_msg.readFully( buffer_byte);
|
||||||
|
|
||||||
Output_File.write( buffer_byte, 0, buffer_byte.length);
|
if( Trim_Mode)
|
||||||
|
{
|
||||||
|
String buffer_string = new String( buffer_byte).trim();
|
||||||
|
buffer_byte = buffer_string.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
Output_File.write( buffer_byte, 0, buffer_byte.length);
|
||||||
|
|
||||||
MQSDelete_Msg( input_msg);
|
if( Copy_Mode == false )
|
||||||
|
{
|
||||||
|
MQSDelete_Msg( input_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg_type = input_msg.readString( MSGTYPE_LEN);
|
||||||
|
|
||||||
|
switch( mode)
|
||||||
|
{
|
||||||
|
case MODE_FLUSH:
|
||||||
|
{
|
||||||
|
if( msg_type.equals( TYPE_SWIFTBEGIN))
|
||||||
|
{
|
||||||
|
if( first_flush)
|
||||||
|
{
|
||||||
|
// System.out.print( "FB1 ");
|
||||||
|
Counter_Print( Total_Nb++, '#');
|
||||||
|
|
||||||
|
MQSDelete_Msg( input_msg);
|
||||||
|
|
||||||
|
first_flush = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// System.out.print( "FB2 ");
|
||||||
|
mode = MODE_SCAN;
|
||||||
|
|
||||||
|
first_flush = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTEND) || msg_type.equals( TYPE_SWIFTERROR))
|
||||||
|
{
|
||||||
|
// System.out.print( "FEA ");
|
||||||
|
Counter_Print( Total_Nb++, '#');
|
||||||
|
|
||||||
|
MQSDelete_Msg( input_msg);
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTOUT))
|
||||||
|
{
|
||||||
|
// System.out.print( "FO ");
|
||||||
|
Counter_Print( Total_Nb++, '*');
|
||||||
|
|
||||||
|
if( Flushed_Nb > 1)
|
||||||
|
{
|
||||||
|
Flush_File.write( Message_Break.getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
input_msg.readString( FILLER_LEN);
|
||||||
|
buffer_byte = new byte[ input_msg.getMessageLength() - MSGTYPE_LEN - FILLER_LEN];
|
||||||
|
input_msg.readFully( buffer_byte);
|
||||||
|
|
||||||
|
if( Trim_Mode)
|
||||||
|
{
|
||||||
|
String buffer_string = new String( buffer_byte).trim();
|
||||||
|
buffer_byte = buffer_string.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
Flush_File.write( buffer_byte, 0, buffer_byte.length);
|
||||||
|
|
||||||
|
MQSDelete_Msg( input_msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println( "Invalid msg_type: (" + msg_type + ") !");
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case MODE_SCAN:
|
||||||
|
{
|
||||||
|
get_first = false;
|
||||||
|
|
||||||
|
if( first_scan)
|
||||||
|
{
|
||||||
|
if( msg_type.equals( TYPE_SWIFTBEGIN))
|
||||||
|
{
|
||||||
|
// System.out.print( "SB1 ");
|
||||||
|
first_scan = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// System.out.print( "SAEO ");
|
||||||
|
|
||||||
|
mode = MODE_FLUSH;
|
||||||
|
get_first = true;
|
||||||
|
first_scan = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTBEGIN))
|
||||||
|
{
|
||||||
|
// System.out.print( "SB2 ");
|
||||||
|
|
||||||
|
mode = MODE_FLUSH;
|
||||||
|
get_first = true;
|
||||||
|
first_scan = true;
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTERROR))
|
||||||
|
{
|
||||||
|
// System.out.print( "SA ");
|
||||||
|
|
||||||
|
mode = MODE_FLUSH;
|
||||||
|
get_first = true;
|
||||||
|
first_scan = true;
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTEND))
|
||||||
|
{
|
||||||
|
// System.out.print( "SE ");
|
||||||
|
|
||||||
|
mode = MODE_MOVE;
|
||||||
|
get_first = true;
|
||||||
|
first_scan = true;
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTOUT))
|
||||||
|
{
|
||||||
|
// System.out.print( "SO ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println( "Invalid msg_type: (" + msg_type + ") !");
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
Counter_Print( Total_Nb++, '~');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case MODE_MOVE:
|
||||||
|
{
|
||||||
|
if( msg_type.equals( TYPE_SWIFTBEGIN))
|
||||||
|
{
|
||||||
|
// System.out.print( "MB ");
|
||||||
|
Counter_Print( Total_Nb++, '#');
|
||||||
|
|
||||||
|
MQSDelete_Msg( input_msg);
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTEND))
|
||||||
|
{
|
||||||
|
// System.out.print( "ME ");
|
||||||
|
Counter_Print( Total_Nb++, '#');
|
||||||
|
|
||||||
|
MQSDelete_Msg( input_msg);
|
||||||
|
|
||||||
|
mode = MODE_SCAN;
|
||||||
|
get_first = true;
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTERROR))
|
||||||
|
{
|
||||||
|
System.out.println( "Internal error: (" + msg_type + ") found during Move!");
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
else if( msg_type.equals( TYPE_SWIFTOUT))
|
||||||
|
{
|
||||||
|
// System.out.print( "MO ");
|
||||||
|
Counter_Print( Total_Nb++, '.');
|
||||||
|
|
||||||
|
if( Moved_Nb > 1)
|
||||||
|
{
|
||||||
|
Output_File.write( Message_Break.getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
input_msg.readString( FILLER_LEN);
|
||||||
|
buffer_byte = new byte[ input_msg.getMessageLength() - MSGTYPE_LEN - FILLER_LEN];
|
||||||
|
input_msg.readFully( buffer_byte);
|
||||||
|
|
||||||
|
if( Trim_Mode)
|
||||||
|
{
|
||||||
|
String buffer_string = new String( buffer_byte).trim();
|
||||||
|
buffer_byte = buffer_string.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
Output_File.write( buffer_byte, 0, buffer_byte.length);
|
||||||
|
|
||||||
|
MQSDelete_Msg( input_msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println( "Invalid msg_type: (" + msg_type + ") !");
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
while( input_msg != null);
|
while( input_msg != null);
|
||||||
|
|
||||||
|
if( MBTrailer_Mode)
|
||||||
|
{
|
||||||
|
Output_File.write( Message_Break.getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println( "\n");
|
System.out.println( "\n");
|
||||||
|
|
||||||
return( msg_nb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch( Exception Expt)
|
catch( Exception Expt)
|
||||||
@@ -444,19 +770,22 @@ public class MQSSave
|
|||||||
|
|
||||||
public MQSSave( String args[])
|
public MQSSave( String args[])
|
||||||
{
|
{
|
||||||
int msg_nb;
|
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();
|
BufferedOutputStream Output_File = null, Flush_File = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
System.out.println("MQSSave: " + MQSSave_Tag + " / " + MQSSave_Date + " / " + MQSSave_Author);
|
||||||
|
|
||||||
if( ( args.length < 2) || ( args.length > 4))
|
if( ( args.length < 2) || ( args.length > 7))
|
||||||
{
|
{
|
||||||
System.out.println( "Usage: MQSLoad [-mb \"message_break\"] <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) + ")");
|
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);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -464,42 +793,70 @@ public class MQSSave
|
|||||||
|
|
||||||
Arg_Parse( args);
|
Arg_Parse( args);
|
||||||
|
|
||||||
System.out.println( "Output File Name: (" + File_Name + ") Input MsgQue Name: (" + MsgQ_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) + ")");
|
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();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedOutputStream Output_file = new BufferedOutputStream( new FileOutputStream( File_Name));
|
Output_File = new BufferedOutputStream( new FileOutputStream( Output_File_Name));
|
||||||
|
|
||||||
|
if( TI_Swift_Batch_Mode)
|
||||||
|
{
|
||||||
|
System.out.println( "Legend: .: Saved *: Flushed #: Skiped ~: Scaned");
|
||||||
|
Flush_File = new BufferedOutputStream( new FileOutputStream( Flush_File_Name));
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// System.out.println("Output File Open: (" + Output_file + ") !");
|
// System.out.println("Output File Open: (" + Output_file + ") !");
|
||||||
|
|
||||||
time_begin = System.currentTimeMillis();
|
time_begin = System.currentTimeMillis();
|
||||||
msg_nb = Save_File( Output_file);
|
Save_File( Output_File, Flush_File);
|
||||||
time_end = System.currentTimeMillis();
|
time_end = System.currentTimeMillis();
|
||||||
|
|
||||||
time_elapsed = ( time_end - time_begin) / 100.0;
|
time_elapsed = ( time_end - time_begin) / 100.0;
|
||||||
speed = msg_nb / time_elapsed;
|
speed = Total_Nb / time_elapsed;
|
||||||
|
|
||||||
nf.setMinimumFractionDigits(2);
|
nf.setMinimumFractionDigits(2);
|
||||||
nf.setMaximumFractionDigits(2);
|
nf.setMaximumFractionDigits(2);
|
||||||
|
|
||||||
System.out.println( "Saved Message Nb: (" + msg_nb
|
if( TI_Swift_Batch_Mode)
|
||||||
+ ") Elapsed Time: (" + nf.format(time_elapsed)
|
{
|
||||||
+ ") s Speed: (" + nf.format(speed)
|
System.out.println( "Saved Message Nb: (" + Moved_Nb + ") Skiped Message Nb: (" + Skiped_Nb + ") Flushed Message Nb: (" + Flushed_Nb + ") Scaned Message Nb: (" + Scaned_Nb + ")");
|
||||||
+ ") msg/s");
|
System.out.println( "Total Message Nb: (" + Total_Nb
|
||||||
|
+ ") Elapsed Time: (" + nf.format(time_elapsed)
|
||||||
|
+ ") s Speed: (" + nf.format(speed)
|
||||||
|
+ ") msg/s");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println( "Saved Message Nb: (" + Total_Nb
|
||||||
|
+ ") Elapsed Time: (" + nf.format(time_elapsed)
|
||||||
|
+ ") s Speed: (" + nf.format(speed)
|
||||||
|
+ ") msg/s");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch( Exception Expt)
|
catch( Exception Expt)
|
||||||
{
|
{
|
||||||
Output_file.close();
|
Output_File.close();
|
||||||
|
|
||||||
|
if( TI_Swift_Batch_Mode)
|
||||||
|
{
|
||||||
|
Flush_File.close();
|
||||||
|
}
|
||||||
|
|
||||||
throw Expt;
|
throw Expt;
|
||||||
}
|
}
|
||||||
|
|
||||||
Output_file.close();
|
Output_File.close();
|
||||||
|
|
||||||
|
if( TI_Swift_Batch_Mode)
|
||||||
|
{
|
||||||
|
Flush_File.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch( Exception Expt)
|
catch( Exception Expt)
|
||||||
@@ -510,6 +867,8 @@ public class MQSSave
|
|||||||
|
|
||||||
MQSDeInit();
|
MQSDeInit();
|
||||||
System.out.println( "MQS Save Completed !");
|
System.out.println( "MQS Save Completed !");
|
||||||
|
|
||||||
|
System.exit( 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,8 +876,9 @@ public class MQSSave
|
|||||||
{
|
{
|
||||||
System.out.println("Exception: (" + Expt + ") !");
|
System.out.println("Exception: (" + Expt + ") !");
|
||||||
Expt.printStackTrace();
|
Expt.printStackTrace();
|
||||||
|
|
||||||
|
System.exit( 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
ReadMe.txt
15
ReadMe.txt
@@ -1,7 +1,7 @@
|
|||||||
# $RCSfile: ReadMe.txt,v $
|
# $RCSfile: ReadMe.txt,v $
|
||||||
# $Revision: 1.2 $
|
# $Revision: 1.4 $
|
||||||
# $Name: $
|
# $Name: $
|
||||||
# $Date: 2002/04/23 18:04:38 $
|
# $Date: 2002/05/21 16:07:17 $
|
||||||
# $Author: giberta1 $
|
# $Author: giberta1 $
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +37,12 @@ Notes:
|
|||||||
- Windows text files: newline is specified as "\r\n",
|
- Windows text files: newline is specified as "\r\n",
|
||||||
- Unix text files: newline is specified as "\n".
|
- Unix text files: newline is specified as "\n".
|
||||||
|
|
||||||
- By default Message break is "\r\n".
|
- The Flush File is only used when TI Swift Batch Mode is enabled (by setting "-tisbm" command line switch).
|
||||||
|
|
||||||
|
- When trim mode is enabled (by setting "-tm" command line switch), all the trailing spaces are removed.
|
||||||
|
|
||||||
|
- By default Message break is "\r\n",
|
||||||
|
- By default Flush File Name is "flush.txt".
|
||||||
|
|
||||||
- This software is under the GNU General Public License. See GNU-GPL.txt.
|
- This software is under the GNU General Public License. See GNU-GPL.txt.
|
||||||
|
|
||||||
@@ -46,6 +51,8 @@ Notes:
|
|||||||
Usage Example:
|
Usage Example:
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
- To save the messages of the MQ/Series "SWIFT-QUEUE" queu into a swift batch file "swift-batch.txt" with "---MESSAGE-BREAK---" message separator use:
|
- To save the messages of the MQ/Series "SWIFT-QUEUE" queue into a swift batch file "swift-batch.txt" with "---MESSAGE-BREAK---" message separator use:
|
||||||
java MQSSave -mb "---MESSAGE-BREAK---\r\n" swift-batch.txt SWIFT-QUEUE
|
java MQSSave -mb "---MESSAGE-BREAK---\r\n" swift-batch.txt SWIFT-QUEUE
|
||||||
|
|
||||||
|
- To save the messages of the MQ/Series "SWIFT-QUEUE" queue into a swift batch file "swift-batch.txt" with no message break message and by using the TI Swift Batch Mode, use:
|
||||||
|
java MQSSave -mb "" -tisbm swift-batch.txt SWIFT-QUEUE
|
||||||
|
|||||||
@@ -1,13 +1,73 @@
|
|||||||
# $RCSfile: ReleaseNotes.txt,v $
|
# $RCSfile: ReleaseNotes.txt,v $
|
||||||
# $Revision: 1.2 $
|
# $Revision: 1.8 $
|
||||||
# $Name: $
|
# $Name: $
|
||||||
# $Date: 2002/04/23 16:24:15 $
|
# $Date: 2003/09/04 15:47:10 $
|
||||||
# $Author: giberta1 $
|
# $Author: giberta1 $
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
MQSSave V 1.1.5 - A. Gibert - 04/09/03
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Add message break trailer mode support,
|
||||||
|
Add -mbtm option,
|
||||||
|
Add copy mode support,
|
||||||
|
Add "-cm" option.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
MQSSave V 1.1.4 - A. Gibert - 29/07/02
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Fix trim mode support when tisbm off.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
MQSSave V 1.1.3 - A. Gibert - 21/05/02
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Add trim mode support,
|
||||||
|
Add "-tm" option,
|
||||||
|
Add MQQueueManager() auto retry,
|
||||||
|
Fix flush file name bad parsing bug,
|
||||||
|
Add version, date and author print out.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
MQSSave V 1.1.2 - A. Gibert - 13/05/02
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Rename SWIFTABORT into SWIFTERROR,
|
||||||
|
Add Legend printout line.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
MQSSave V 1.1.1 - A. Gibert - 06/05/02
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Add return code handling.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
MQSSave V 1.1.0 - A. Gibert - 03/05/02
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Add TI Swift batch mode support,
|
||||||
|
Add "-tisbm" command line switch,
|
||||||
|
Add flush file support,
|
||||||
|
Add "-ffn" command line switch,
|
||||||
|
Fix MQSSave usage print: replace MQSLoad by MSSave !
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
MQSSave V 1.0.0 - A. Gibert - 23/04/02
|
MQSSave V 1.0.0 - A. Gibert - 23/04/02
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user