Re: call rpgle program from within a java program...
Gerald Magnuson <[email protected]>
| Newsgroups | gmane.comp.lang.as400.java |
|---|---|
| Message-ID | <CAN-KPi48C37B6mXU9aw8aux4VKCzWEeQbpJ88UJboScsgGhGZA@mail.gmail.com> |
kk... here is my full code... it compiles, but with PCML document
source '/tmp/GETMQMSG.pcml' cannot be found
import com.rabbitmq.client.*;
import com.ibm.as400.access.AS400;
import com.ibm.as400.data.PcmlException;
import com.ibm.as400.data.ProgramCallDocument;
import java.io.IOException;
public class Recv {
public static void main(String[] args) throws Exception {
String hostParm = args[0].trim();
String userNameParm = args[1].trim();
String passwordParm = args[2].trim();
String virtualHostParm = args[3].trim();
String queueNameParm = args[4].trim();
String messageParm = args[5].trim();
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(hostParm);
factory.setUsername(userNameParm);
factory.setPassword(passwordParm);
factory.setVirtualHost(virtualHostParm);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
Consumer consumer = new DefaultConsumer(channel) {
@Override
public void handleDelivery(String consumerTag, Envelope envelope,
AMQP.BasicProperties properties, byte[] body)
throws IOException {
String message = new String(body, "UTF-8");
AS400 as400;
ProgramCallDocument pcd;
String path = "/QSYS.LIB/GEMLIB.LIB/GETMQMSG.PGM";
as400 = new AS400 ();
try {
pcd = new ProgramCallDocument(as400, "/tmp/GETMQMSG.pcml");
pcd.setValue ("GETMQMSG.MESSAGE", message);
boolean rc = pcd.callProgram("GETMQMSG");
} catch (PcmlException e) {
e.printStackTrace();
}
}
};
channel.basicConsume(queueNameParm, true, consumer);
}
}
On Tue, Sep 25, 2018 at 3:36 PM Jack Woehr <[email protected]>
wrote:
> On Tue, Sep 25, 2018 at 2:16 PM David Gibbs <david-Zwy7GipZuJhWk0Htik3J/[email protected]> wrote:
>
> > https://code.midrange.com/692bdd33f5.html
> >
>
> Nice!
> --
> Absolute Performance, Inc.
> 12303 Airport Way, Suite 100
> Broomfield, CO 80021
>
> NON-DISCLOSURE NOTICE: This communication including any and all
> attachments is for the intended recipient(s) only and may contain
> confidential and privileged information. If you are not the intended
> recipient of this communication, any disclosure, copying further
> distribution or use of this communication is prohibited. If you received
> this communication in error, please contact the sender and delete/destroy
> all copies of this communication immediately.
> --
> This is the Java Programming on and around the IBM i (JAVA400-L) mailing
> list
> To post a message email: JAVA400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/java400-l
> or email: JAVA400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/java400-l.
>
>
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list
To post a message email: JAVA400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/java400-l.