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



CRPence skrev den 10-08-2008 00:16:
Presumably already known, includes that SNDRPY is available from:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/apis/QMHSNDRM.htm

Thank you for your very thorough answer. It gave me a lot of pointers and help to figure this out (which gave me the vocabulary to discover how others discussed this previously without me understanding it to be the issue :)

My goal was to provide the Java program the ability to detect and handle the MSGW situation without a human needing to use a green screen. By using a second AS400 object (hence a different prestarted job answering) I can watch the job with something like

Job j = new Job(systemi, job.getInternalJobIdentifier());
do {
Thread.sleep(1000);
j.loadInformation();
} while (Job.ACTIVE_JOB_STATUS_WAIT_MESSAGE.equals(j.getValue(Job.ACTIVE_JOB_STATUS))

Either a default response is already known or a developer can be presented with formatted versions of j.getCallStack(Job.INITIAL_THREAD) and jobLog.getMessages(0, jobLog.getLength()) to determine a specific response in the situation.


That the inquiry message [for which a reply message is being awaited] would be in QSYSOPR versus some other message queue, is an assumption.
I assume for now that the inquiry message is in QSYSOPR (our guru is on vacation), so this snippet will send the response and delete the message:

String jobId = getJobId(job.getNumber(), job.getUser(), job.getName());
MessageQueue queue = new MessageQueue(systemi, "/QSYS.LIB/QSYSOPR.MSGQ");
Enumeration messages = queue.getMessages();
while (messages.hasMoreElements()) {
QueuedMessage message = (QueuedMessage) messages.nextElement();
message.load();
if (message.getType() == AS400Message.INQUIRY) {
message = queue.receive(message.getKey(), 0, MessageQueue.SAME, MessageQueue.ANY);
String number = message.getFromJobNumber();
String user = message.getUser();
String name = message.getFromJobName();
if (jobId.equals(getJobId(number,user,name))) {
System.out.println("Got it!");
queue.reply(message.getKey(), response);
}
}
}
...
private static String getJobId(String number, String user, String name) {
return number + "/" + user + "/" + name;
}

Hopefully this can help others, and if there is comments I'd like to hear them :) Now I just need to get this to production quality :-S

Thanks again.


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.