Author |
Message
|
sfari |
Posted: Mon Mar 22, 2004 11:17 pm Post subject: Java client sends message to COBOL server |
|
|
Centurion
Joined: 15 Apr 2003 Posts: 144
|
We need to feed a COBOL transaction with data using a Java client. This input data is sent to the host using a MQ remote queue.
Thus means the message has to be converted into a structure like defined in the COBOL copybook at putting time.
Is there somebody doing something similar to this? Can somebody recommend a product for such a translation from COBOL to Java objects?
Thanks
Silvano |
|
Back to top |
|
 |
kirani |
Posted: Mon Mar 22, 2004 11:50 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Have you looked at WebSphere Business Integration Message Broker? It can take certain JMS message types (JMSMap, JMSStream) as input and convert them into COBOL copybook format. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 23, 2004 4:15 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Kirani is right that WBI Message Broker is an excellent product for this general class of problem.
It may, however, be a bit of overkill for this particular application.
Ask yourself how many Java applications you will have talking to how many COBOL applications. If it's just one and one, then you can just build the copybook formatted data yourself in the MQ Message using writeString and writeInt and etc. from the Java MQ APIs.
If it gets to be more than about five COBOL applications, you should start thinking about investing in WBI Message Broker - as you'll be able to then completely isolate your COBOL applications from your Java applications, and make significant changes (including replacing entire applications with new ones) without having to change the other side. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
clindsey |
Posted: Tue Mar 23, 2004 6:42 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
Sfari,
If you decide to build a home grown app, here is a code snippet that will get you started on converting a copy book to java stream.
Code: |
//MQIIH-STRUCID PIC X(4) VALUE 'IIH '. ** Structure version number
//MQIIH-VERSION PIC S9(9) BINARY VALUE 1. ** Length of MQIIH structure
//MQIIH-STRUCLENGTH PIC S9(9) BINARY VALUE 84. ** Structure length
//MQIIH-ENCODING PIC S9(9) BINARY VALUE 0. ** Reserved
//MQIIH-CODEDCHARSETID PIC S9(9) BINARY VALUE 0. ** Reserved
//MQIIH-FORMAT PIC X(8) VALUE SPACES. ** MQ format name of data that follows MQIIH
//MQIIH-FLAGS PIC S9(9) BINARY VALUE 0. ** Flags
//MQIIH-LTERMOVERRIDE PIC X(8) VALUE SPACES. ** Logical terminal override
//MQIIH-MFSMAPNAME PIC X(8) VALUE SPACES. ** Message format services map name
//MQIIH-REPLYTOFORMAT PIC X(8) VALUE SPACES. ** MQ format name of reply message
//MQIIH-AUTHENTICATOR PIC X(8) VALUE SPACES. ** RACF password or passticket
//MQIIH-TRANINSTANCEID PIC X(16) VALUE LOW-VALUES. ** Transaction instance identifier
//MQIIH-TRANSTATE PIC X VALUE ' '. ** Transaction state
//MQIIH-COMMITMODE PIC X VALUE '0'. ** Commit mode
//MQIIH-SECURITYSCOPE PIC X VALUE 'C'. ** Security scope
//MQIIH-RESERVED PIC X VALUE SPACES. ** Reserved
msg.writeString("IIH "); // MQIIH_STRUCT_ID
msg.writeInt(1); // MQIIH_VERSION_1
msg.writeInt(84); // MQIIH_LENGTH_1
msg.writeInt(0); // 4 byte reserved
msg.writeInt(0); // 4 byte reserved
msg.writeString("MQIMSVS "); // MQFMT_IMS_VAR_STRING
msg.writeInt(0); // MQIIH_NONE
msg.writeString("MASTER "); // 8 byte ltermoverride
msg.writeString("MODU03 "); // 8 byte mfsmapname
msg.writeString("MQIMSVS "); // MQFMT_IMS_VAR_STRING
msg.writeString(" "); // 8 byte authenticator
msg.writeString("0000000000000000"); // 16 byte transid
msg.writeString(" "); // MQITS_NOT_IN_CONVERSATION
msg.writeString("0"); // MQICM_COMMIT_THEN_SEND
msg.writeString("C"); // MQIIS_CHECK
msg.writeString(" "); // 1 byte reserved
|
Charlie |
|
Back to top |
|
 |
sfari |
Posted: Tue Mar 23, 2004 8:18 am Post subject: |
|
|
Centurion
Joined: 15 Apr 2003 Posts: 144
|
Hi all, thanks for the replies!
Actually we currently only have two applications calling a host transaction over a message queue. But the input for them is quite a lot of data.
Since these cobol copybooks are even sometimes changing a home made implementation is not the way to go in my opinion.
But still I think that WBI Message Broker is a bit of an overkill.
I am rather looking for a tool, which generates Java beans out of COBOL copybook. This beans should then have something like a getBytes() method which returns a structure that's cobol compatible.
Does somebody know something like this? |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 23, 2004 8:54 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
WSAD will do this... If you can generate an XSD from a copybook.
Or you could try searching google for something that will perform data binding between Java objects and Cobol structures - like JAXB, but JACB. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sfari |
Posted: Wed Mar 24, 2004 7:28 am Post subject: |
|
|
Centurion
Joined: 15 Apr 2003 Posts: 144
|
Until now we have been using CCF included in Visual Age for Java this cases.
I already had a look at the new product "WebSphere Application Developer Integration Edition". There are lots of connectors but no MQ connector.
And what also conserns me using this product is that everything is very tight to WS application server. Since we are not using this appl. server it makes not a lot of sense for us to use the product.
In case it is possible to generate such Java beans, which are not tight to EJBs we might consider using it anyway. Great would be a separate eclipse plugin or command line tool to do this!
Has somebody more experience in that. |
|
Back to top |
|
 |
|