× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,
the 2 seconds delay was fixed by a PTF, do not remember the number...

On Tue, 13 Apr 2004 10:49:44 -0600, Tim Gosnell wrote:


>I have a test set up where a client application writes to a data queue
>(inQueue) and reads from another one (outQueue).  I have written server
>applications in both Java and Cobol (included).

>I have the java client reporting the difference between
>System.currentTimeMillis(); at the start and at the end of each
>transactions.  I expect some variance in elapsed time reported.  The issue
>here is that the variance in elapsed time is wide.  I get millisecond
>reports varying from less than one millisecond all the way up the low 2000
>millisecond range.   

>Why would/how could the elapsed times for the transaction vary so much?
>These programs caps the number of transactions at 1000.  The connections are
>closed from the client.  The data being written and read in each case does
>not change. 

>Need help...

>Cobol Code:

>       ID DIVISION.
>       PROGRAM-ID.  TESTDQ.
>       ENVIRONMENT DIVISION.
>       CONFIGURATION SECTION.
>        SOURCE-COMPUTER. IBM-AS400.
>        OBJECT-COMPUTER. IBM-AS400.

>       DATA DIVISION.
>        FILE SECTION.


>        WORKING-STORAGE SECTION.

>      *  COPY QUSEC OF QSYSINC-QLIBSRC.
>      *  COPY QCAPCMD OF QSYSINC-QLIBSRC.
>         01 IN-QUEUE-NAME       PIC X(10) VALUE "TESTINDQ".
>         01 QUEUE-LIB-NAME      PIC X(10) VALUE "FOO".
>         01 OUT-QUEUE-NAME      PIC X(10) VALUE "TESTOUTDQ".
>         01 WAIT-TIME           PIC S9(05) VALUE -1 PACKED-DECIMAL.
>         01 MSG-SIZE            PIC S9(05) VALUE 50 PACKED-DECIMAL.
>         01 REQUEST             PIC X(50).
>         01 RESPONSE            PIC X(50) VALUE "This is the response".
>         01 INCREMENT           PIC S9(01) VALUE 1 PACKED-DECIMAL.
>         01 REQUEST-NUM         PIC S9(05) VALUE 1 PACKED-DECIMAL.
>         01 START-TIME          PIC S9(05).
>         01 END-TIME            PIC S9(05).

>        PROCEDURE DIVISION.
>        MAIN.

>                CALL "QRCVDTAQ" USING IN-QUEUE-NAME, QUEUE-LIB-NAME,
>                                       MSG-SIZE, REQUEST, WAIT-TIME.


>                CALL "QSNDDTAQ" USING OUT-QUEUE-NAME, QUEUE-LIB-NAME,
>                                       MSG-SIZE, RESPONSE.

>                ADD INCREMENT TO REQUEST-NUM.
>           IF REQUEST-NUM = 1000 STOP RUN.
>           PERFORM MAIN. 


>Test Client Application Code:

>package com.critrade.sandbox;

>import java.sql.CallableStatement;
>import java.sql.Connection;
>import java.sql.Driver;
>import java.sql.DriverManager;
>import java.util.Properties;

>import junit.framework.TestCase;

>import com.ibm.as400.access.AS400;
>import com.ibm.as400.access.DataQueue;
>import com.ibm.as400.access.DataQueueAttributes;
>import com.ibm.as400.access.DataQueueEntry;
>import com.ibm.as400.access.QSYSObjectPathName;

>/**
> * @author TimG
> *
> */
>public class TestDTAQClient extends TestCase
>{

>    static final int WAIT_TIME = -1;

>       DataQueue inQueue = null;
>       DataQueue outQueue = null;
>       AS400 host = null;
>       QSYSObjectPathName inQueuePath = null;
>       QSYSObjectPathName outQueuePath = null;
>      Connection con = null;
>      CallableStatement cs = null;
>    
>      String entry = "new test entry - new test entry - new test entry";
>    
>       public TestDTAQClient(String myName)
>       {
>               super(myName);

>       }

>       public static void main(String[] args)
>       {
>        junit.textui.TestRunner.run(new TestDTAQClient("testTransaction"));
>       }

>       protected void setUp() throws Exception
>       {
>               System.out.println("Establishing Database Connection");
>               host = new AS400("128.128.2.220", "foo", "bar");
>               DataQueueAttributes dtaqAttrib = new DataQueueAttributes();
>               try
>               {
>                       inQueuePath = new QSYSObjectPathName("foo",
>"testindq", "dtaq");
>                       
>                       inQueue = new DataQueue(host,
>inQueuePath.getPath());
>                       if(!inQueue.exists()) 
>                inQueue.create(dtaqAttrib);

>               }
>               catch (Exception e)
>               {
>                       e.printStackTrace();
>               }
>        try
>        {
>            outQueuePath =
>                new QSYSObjectPathName("foo", "testoutdq", "dtaq");
>            outQueue = new DataQueue(host, outQueuePath.getPath());
>            if(!outQueue.exists())
>                outQueue.create(dtaqAttrib);
>        }
>        catch(Exception e)
>        {
>            e.printStackTrace();
>        }

>       }

>       protected void tearDown()
>       {
>               try
>               {
>            if(con!=null){con.close();}
>               }
>               catch (Exception ex)
>               {
>                       System.out.println(ex.getMessage());
>               }
>       }
>    
>       public void testInQueueWrite()
>       {
>               try
>               {
>                       inQueue.write(entry);
>               }
>               catch (Exception e)
>               {
>                       e.printStackTrace();
>               }

>    }
>    
>    public void testOutQueueRead()
>    {
>        try
>        {
>            DataQueueEntry entry = outQueue.read(WAIT_TIME);
>        }
>        catch (Exception e)
>        {
>            e.printStackTrace();
>        }
>    }
>    
>    public void testTransaction()
>    {
>        
>        for(int i = 0; i < 1000; i++)
>        {
>                        
>            long start = System.currentTimeMillis();
>            testInQueueWrite();
>            testOutQueueRead();
>            long end = System.currentTimeMillis();
>            System.out.println("" + (end - start));
>        }
>    }
>}


>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.642 / Virus Database: 410 - Release Date: 3/24/2004
> 



-----------------------------------------------------------------------------
*** This messages was scanned for malicious contents ***
-----------------------------------------------------------------------------
Franco Biaggi
CH-6807 Taverne


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.