× 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.



I am pretty sure the Toolbox DQ code won't write an empty entry when it
creates the queue.  Any chance the message and ID are zero length strings?
It looks like an entry would be written to the queue even though there is
no data.  Record.getContents() returns a byte array.  You could println the
length of the byte array to see if it is ever 0 bytes.

David Wall
553-5329
AS/400 Toolbox for Java




                    "Mike Silvers"
                    <msilvers@hbs-inc.       To:     "Java 400-L" 
<java400-l@midrange.com>
                    com>                     cc:
                    Sent by:                 Subject:     Data Queue 
communication between RPG and Java
                    java400-l-admin@mi
                    drange.com


                    10/12/2001 02:01
                    PM
                    Please respond to
                    java400-l





Hi all....

I am experienceing a problem using data queue communications between an RPG
program and a java program.  I have the java program running on a PC.  The
java program connects to the AS/400 and writes to the data queue.  The RPG
program is sitting on the data queue monitor API.  The problem is that the
RPG program detects that a blank record was written to the data queue when
I
did not write a record at all.  It almost seems like the java program is
writing a blank record when it creates the data queue object.  Anyone else
experience this problem?

My code is as follows:

 //  Define the new data queue

 frd = new AS400FileRecordDescription(as400, pr.getResponseDataqPath() +
        pr.getResponseDataq() + ".FILE");

 try  {
  dqOutFormat = frd.retrieveRecordFormat()[0];
  dqOut = new DataQueue(as400, pr.getResponseDataqPath() +
pr.getResponseDataq() +
      ".DTAQ");

  System.out.println("OutDataQueue connection made to: " +
pr.getResponseDataqPath() +
     pr.getResponseDataq() + ".DTAQ");

  } catch (Exception e) {
    System.out.println("*** OutDataQueue exception: " + e);
  }

  //  Send the data queue entry (only if it is 7 long)

  if ((id.length() <= 7) || (msg.length() <= 100)) {
    recOut = dqOutFormat.getNewRecord();
    recOut.setField("PRERRMSGID", id);
    recOut.setField("PRERRMSGTX", msg);

    System.out.println("Fields set with the values \n      PRERRMSGID: " +
id +
        "\n      PRERRMSGTX: " + msg);

    try {
        dqOut.write(recOut.getContents());

        System.out.println("\nData Structure written to: " + dqOut.getPath
()
+
            dqOut.getName());

    } catch (UnsupportedEncodingException uec)  {
      System.out.println("OutDataQueue exception: " + uec);
    } catch (ObjectDoesNotExistException ode)  {
      System.out.println("OutDataQueue exception: " + ode);
    } catch (CharConversionException cc)  {
      System.out.println("OutDataQueue exception: " + cc);
    } catch (InterruptedException ie)  {
      System.out.println("OutDataQueue exception: " + ie);
    } catch (IllegalObjectTypeException iet)  {
      System.out.println("OutDataQueue exception: " + iet);
    } catch (IOException ioe)  {
      System.out.println("OutDataQueue exception: " + ioe);
    } catch (ErrorCompletingRequestException ecr)  {
      System.out.println("OutDataQueue exception: " + ecr);
    } catch (AS400SecurityException se)  {
      System.out.println("OutDataQueue exception: " + se);
    }

  } else  {
    System.out.println("OutDataQueue error:  length of DTAQ entry.  The " +
        "required length of the message ID is 7 or less.  \nThe current  "
+
        "length is " + id.length() + ". \nThe length of the message text
is:
" +
        msg.length() + "." );
  }

Thanks!

Mike

================================

Mike Silvers
AS/400 Senior Programmer/Analyst
AS/400 IBM Certified RPG IV Developer
AS/400 IBM Certified Expert
Hainey Business Systems
8 E. Canal St
Dover, PA 17315
Branch Office:  (410) 397-8739
Phone:  (800) 932-3380
Fax:  (717) 292-9474
Web: http://www.hbs-inc.com
________________________________
Providing E-Commerce, EDI, AS/400
Development and related services
nationwide.
================================


_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.







As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.