ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API SupportRead Copybook using MQAPI-Java

Post new topicReply to topic
Read Copybook using MQAPI-Java View previous topic :: View next topic
Author Message
rengajava
PostPosted: Sun Apr 12, 2015 9:53 am Post subject: Read Copybook using MQAPI-Java Reply with quote

Newbie

Joined: 10 Dec 2014
Posts: 6

Hi,

I try to read copybook message from queue using Java MQAPI, I am able to read message but it is not expected copybook format, Kindly guide me to solve this issue.

Thanks & Regards,
M.Rengaraj.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Sun Apr 12, 2015 11:33 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

What does the message look like? What format were you expecting?

What app created the message? What format did the creating app use?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
rengajava
PostPosted: Sun Apr 12, 2015 10:23 pm Post subject: Reply with quote

Newbie

Joined: 10 Dec 2014
Posts: 6

Hi Bruce,

I need read a cobol copy book message, when I read it using RFHUtil I will load copybook in Data Tab, after loading it diplay below

CASE1:

Level Ofs Len Type Occ Variable Name Value
01 0 83723 MERGED-RECORD
02 0 73 PP-COMMUNICATION-AREA-LK
05 0 29 PP-SYSTEM-COMMU-AREA-LK
10 0 2 NUMB PP-SYSTEM-RO-LK 91
10 2 5 NUMB PP-PROCESSING-DATE-LK 21415
10 7 2 CHAR PP-SYSTEM-ID-LK ab
10 9 2 CHAR PP-SYSTEM-REQUEST-PROC-LK 01
10 11 8 CHAR PP-CALLING-MODULE-LK N
10 19 10 CHAR FILLER

CASE2:
Even If I didnt load copybook in RFHUTIL, directly browse message it's displaying like below,

00000000 9121415ab01 N 911
00000032 3511047K 2015040812ab12345678912
00000064 345678912P00YNN............YNN91
00000096 13047511K .& ð..ð...........&...
00000128 .... 080001200000N00000000000 0
00000160 0000000000 00000000000 0000000
00000192 0000 00000000000 00000000000
00000224 00000000000 00000000000 .æ.@..
00000256 ....... .. .. 00000000 ...
00000288 .î. Y R0000000000FOCP0000000Á..


The same case I need to do using MQAPI, If I directly browse a message using MQJAVA API as like as CASE2 I am getting some junk, But I dont know How to load Copybook while reading message from queue.

I use CharSet:285 , Encode:785

Kindly suggest me on this.

Thanks & Regards,
M.Rengaraj.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Apr 13, 2015 4:15 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

rengajava wrote:
The same case I need to do using MQAPI, If I directly browse a message using MQJAVA API as like as CASE2 I am getting some junk, But I dont know How to load Copybook while reading message from queue.

I use CharSet:285 , Encode:785


How do you "use" those values? Why would you use explicit values rather than have MQ do the conversion automatically? How do you know that those values are the ones used to create the message? Have you checked using RFHUtil?

By "junk" do you mean it doesn't look like what you're getting in RFHUtil, or does it look like the same "junk" as RFHUtil, which does look rather like a COBOL message to me. If it works in RFHUtil, what is RFHUtil likely to be doing differently to your application?

(My earlier questions are a hint)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
rengajava
PostPosted: Mon Apr 13, 2015 5:50 am Post subject: Reply with quote

Newbie

Joined: 10 Dec 2014
Posts: 6

Hi Vitor,

Thanks for your reply,

i used CharSet:285 , Encode:785 to read from queue via WMB flow , so i used the same in Java App,

I didnt see any difference in message if it took automatically or using given charset,encoding. I just given those when i send message to mainframe, once mainframe reply's message comes to one queue to read from that i am using Java MQ API,

In the same way I am able to read XML meessages which is coming from mainframe , Also I am able to read copybook messages but it is not expected format, as it is coming as EBIDIC format.

Level Ofs Len Type Occ Variable Name Value
01 0 83723 MERGED-RECORD
02 0 73 PP-COMMUNICATION-AREA-LK
05 0 29 PP-SYSTEM-COMMU-AREA-LK
10 0 2 NUMB PP-SYSTEM-RO-LK 91
10 2 5 NUMB PP-PROCESSING-DATE-LK 21415
10 7 2 CHAR PP-SYSTEM-ID-LK ab
10 9 2 CHAR PP-SYSTEM-REQUEST-PROC-LK 01
10 11 8 CHAR PP-CALLING-MODULE-LK N
10 19 10 CHAR FILLER

But if i didnt load copy book I am getting wrong format.

Simlarly, Kindly suggest how to load copybook in MQJavaAPI.

Thanks & Regards,
M.Rengaraj
When we use RFHUTIL to read it, we load copybook to view in segment wise like below
Back to top
View user's profile Send private message
bruce2359
PostPosted: Mon Apr 13, 2015 6:17 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

rengajava wrote:

i used CharSet:285 , Encode:785 to read from queue via WMB flow , so i used the same in Java App,

Exactly and precisely how did you use CharSet:285 , Encode:785?

Are you saying that you set these values in the MQMD when you created the messages? Something else? Setting these values in the MQMD doesn't change your message data.

Exactly how did you specify these values in the consuming application?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Apr 13, 2015 6:52 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

rengajava wrote:
i used CharSet:285 , Encode:785 to read from queue via WMB flow , so i used the same in Java App,


Again I ask how exactly are you "using" them? How exactly are you telling your app to use them and why?

rengajava wrote:
I didnt see any difference in message if it took automatically or using given charset,encoding.


Well no, because in my world you can't "use" those values in a Java app; that's a difference between what WMB is doing under the covers with an MQInput node and what you're doing.

rengajava wrote:
In the same way I am able to read XML meessages which is coming from mainframe , Also I am able to read copybook messages but it is not expected format, as it is coming as EBIDIC format.


Why are you not expecting EBCDIC? Char set 285 is an EBCDIC code page, so even if you have somehow managed to "use" it, you're "using" EBCDIC. I again ask, because it's a crucial point, why are you "using" a specific code page (aside from how) and not allowing MQ to handle the message?

rengajava wrote:
But if i didnt load copy book I am getting wrong format.


I suspect you're getting the right format but the wrong code page.

rengajava wrote:
Simlarly, Kindly suggest how to load copybook in MQJavaAPI.


You don't load a copybook into the MQJavaAPI any more that you load an XML schema into the MQJavaAPI. If you read a message using the MQJavaAPI that happens to be XML, you need Java code additional to the API call to parse the XML and validate it against the schema. Similarly, you need code additional to the API to parse and process the COBOL data.

The fact that RFHUtil can load a copybook and display the message data is down to the good graces of the author, who incorporated such code into the RFHUtil application in the same way he included an XML parser and various display formats. It's nothing to do with WMQ.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Apr 14, 2015 4:31 am Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

And let's face it, if you are looking at a copybook format, there are good chances that the data might be sent with format MQFMT_NONE.
This means you'd have to translate all the characters from the CCSID on the message to the Java String... There are methods in Java for that...

Best bet would be for you to write your own COBOL parser bit, or use a DFDL parser...
Have fun ...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Apr 14, 2015 4:59 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The MQAPI doesn't supply any methods to "use" or "read" a copybook.

MQ doesn't format the contents of message data for you, at all. It will convert character and integer fields from one ccsid/encoding to another.

If you have a piece of data that comes in an MQ message, and you know what that piece of data is supposed to look like, you need to write code to extract the individual fields.

If the message comes in that doesn't match the fields that you expect to receive, then.... probably you have an error.
Back to top
View user's profile Send private message
rengajava
PostPosted: Wed Apr 15, 2015 10:32 am Post subject: Reply with quote

Newbie

Joined: 10 Dec 2014
Posts: 6

Hi Guys,
Thanks for your reply,

yes, Finally i am using DFDL to do this functionality. Now I m able to parse and convert copybook using DFDL, i had learned from you,

Thanks,
M.Rengaraj.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API SupportRead Copybook using MQAPI-Java
Jump to:



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
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.