|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Cobol copybook |
« View previous topic :: View next topic » |
Author |
Message
|
gobi_nathan |
Posted: Wed Mar 05, 2003 3:48 am Post subject: Cobol copybook |
|
|
Acolyte
Joined: 08 Jan 2003 Posts: 69
|
Hi All,
Can anyone tell me How to communicate between the Mainframe system and java application using Cobol copybook message.
Mainframe application uses cobol copybook message to receive the message from Java.
I want to know,how the Java application put the message in cobol copybook message format.
What are the steps to be done to pass the message in cobol copybook format.
-Gobi |
|
Back to top |
|
 |
clindsey |
Posted: Wed Mar 05, 2003 7:45 am Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
You have to map to writeInt, writeString, etc methods. Here is an example based on the IMSBridge header. It shows the mapping from a copy book and c structure:
Code: |
/*********************************************************/
/* Write the fields of the MQIIH header to the message */
/* stream. The commented lines document the MQIIH */
/* structure found in cmqc.h and cmqiihv.cpy */
/*********************************************************/
//MQCHAR4 StrucId; /* Structure identifier */
//MQLONG Version; /* Structure version number */
//MQLONG StrucLength; /* Length of MQIIH structure */
//MQLONG Encoding; /* Reserved */
//MQLONG CodedCharSetId; /* Reserved */
//MQCHAR8 Format; /* MQ format name of data that follows MQIIH*/
//MQLONG Flags; /* Flags */
//MQCHAR8 LTermOverride; /* Logical terminal override */
//MQCHAR8 MFSMapName; /* Message format services map name */
//MQCHAR8 ReplyToFormat; /* MQ format name of reply message */
//MQCHAR8 Authenticator; /* RACF password or passticket */
//MQBYTE16 TranInstanceId; /* Transaction instance identifier */
//MQCHAR TranState; /* Transaction state */
//MQCHAR CommitMode; /* Commit mode */
//MQCHAR SecurityScope; /* Security scope */
//MQCHAR Reserved; /* Reserved */
//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
|
This is extracted from a piece of sample code. You can get the entire code sample from http://www.developer.ibm.com/tech/sample_code_handler.pl?action=display&object=/tech/sample_code/mq/imsbridge.java
or for a jms version
http://www.developer.ibm.com/tech/sample_code_handler.pl?action=display&object=/tech/sample_code/mq/JmsIMSBridge.java
Hope this helps,
Charlie |
|
Back to top |
|
 |
gobi_nathan |
Posted: Wed Mar 05, 2003 8:03 pm Post subject: |
|
|
Acolyte
Joined: 08 Jan 2003 Posts: 69
|
Hi clindsey ,
Thanks for your mail.
In following to this mail,i want to know one more thing,I am new to the cobol.So,let me clear my doubts.
How the response messages are normally send back to cobol copybook format from java application.
Are the data are separated using some delimitter value.Or is there any other way so that the cobol application will understand easily.
-Gobi |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 06, 2003 7:12 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
A Cobol copybook is essential a description of the raw bytes in the message buffer. It is analagous to a C structure. The copybook describes what segments of the bitstream should be interpreted as which type of data and what variable to put them into (as I understand it).
There is no delimiter between fields. The copybook explicitly says 'take the first 8 bits of this stream, and call them an int. take the next 256 bits of the stream, and call them a string, take the next 20 bits and call them a packed decimal' or some such.
So in order to build a message that will be interpreted successfully by a copybook, you have to write out each field element to the message bitstream in the same way that the copybook expects it. That's what clindsey meant when he said "You have to map to writeInt, writeString, etc methods. "
The process for doing this in Java is clearly illustrated by the example clindsey posted. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|