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




As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.