How to create the scripts to get the Failed,Started instances within a timestamp!

:)Hi All,

Could anyone please tell me how to create a scrip which can be run as a batch file which will extract the deails of all instances in a specific time interval?

If some one has such a program, coul you please share with me.

I would like to get the no of instances:

  1. Failed
  2. Started
  3. Succeeded
  4. Resubmitted

Or atleast any of these.

Waiting for your immediate response.

Pulling up!

So just to understand more completely, you want something you can run from an OS command line? Which OS? And you want it to return the number of processes at each of the listed states? Do you want the specified time range to be an input, or will it be set?

BTW, I do this now, but I do it via saved searches in MWS, the most important of which I put on my MWS home page.

This is an interesting question, so let us know more specifics and we’ll see what the community comes up with.


Thanks a lot PhilLeary for the interest you have shown.

For the Qns,

  1. Which OS?
    For me it is the windows system

  2. Do you want something you can run from an OS command line?
    Exactly. i would like to have it as a batch file similar to “developer.bat” so that I can run it by just editing the parameters like “time stamp”.

3.And you want it to return the number of processes at each of the listed states?
Yes, perfectly the same. I would like to have the number of instances failed,suceeded etc…with the failed step.

  1. Do you want the specified time range to be an input, or will it be set?
    I would like to have it as an input. As I mentioned earlier, in the batch file if we can edit the parameters and execute it. It will be a gr8 help.

I am also currently doing it with the saved searches. But using the portal and to get the results for each interfaces takes a lot of ime.

I would appeciate is somebody who had already implemented this could explain us how this can be done.

Thanks in advance,


What about using the batch.cmd file to call a Java program? Would that be a violation of your requirement?

If that would be okay, then I’d create a flow to call one of the WmMonitor services, such as ws.monitor.process.instance:getList. Use the flow to reduce the number of input params to just the status input and the range (or toDate/fromDate). Then generate Java code for calling from a client (via Tools->Generate Code). Clean up the Java code a bit, compile, and call from cmd/bat.

Thanks a lot Phil.

Let me try that. If possible could you share with me the code and findings?

Thanks in advance,


Here’s some rough (very rough - generated from Developer and then modified to suit with no attempt to optimize or pretty it up) code you could use as a start.

Usage: java getStatus serverHost serverPort UserName Password Range

This version accepts only “range” as an input to pass to the service (see the ws.monitor.process.instance:getList service to view the full list of inputs you could pass, as well as the options for “range” - for example, Yesterday.)

It also only returns three of the many outputs possible. Again, you could modify for what you want. The status values are numeric, so you might want to add translation (2=Completed for example).

BTW, I should qualify this by saying that you could probably go straight against the classes/methods of the monitor.jar or the bpo-ws.jar, but since those are not documented, I used an existing service.

import java.util.Vector;
import com.wm.util.Table;
import com.wm.util.coder.IDataCodable;

public class getStatus{
    public static void main(String[] args) {
	if (args.length != 5) {
		System.err.println("Usage: java getStatus [IShost] [ISport] [user] [password] [range]");
        String server = args[0]+":"+args[1];
        String username = args[2];
        String password = args[3];
		String range = args[4];
		System.out.println("Invoke for "+server+" "+username+" "+password+" "+range);
        Context context = new Context();
        try {
            context.connect(server, username, password);
        } catch (ServiceException e) {
            System.err.println("\n\tCannot connect to server \""+server+"\"");

        try {
		    IData pipelineIn = IDataFactory.create();
		    IDataCursor idc = pipelineIn.getCursor();
	        idc.insertAfter("range", args[4]);

            IData pipelineOut = context.invoke("ws.monitor.process.instance", "getList", pipelineIn);

            IDataCursor odc = pipelineOut.getCursor();
            Table instances = (Table) odc.getValue();
            IData[] results = instances.getValues();

	    	if (results != null) {
				int current=0;
		    	for (int i = 0; i < results.length; i++) {
					IDataCursor cdc = results[i].getCursor();
					current = i+1;
					System.out.println("Process instance "+current+" of "+results.length+" matching range "+args[4]);
					System.out.println("Name: "+IDataUtil.getString(cdc,"modelName"));
					System.out.println("ID: "+IDataUtil.getString(cdc,"instanceId"));
					System.out.println("Status: "+IDataUtil.getString(cdc,"lastStatus")+"\n");
			} else {
				System.err.println("No results returned - try a different range.");

        } catch (ServiceException e) {

Compile it, then call it according to Usage from your bat.


Hi Phil,

Thanks a lot for your interest. Let me try this.