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 Index » WebSphere Message Broker (ACE) Support » Need Help to parse copybook having REDEFINES

Post new topic  Reply to topic
 Need Help to parse copybook having REDEFINES « View previous topic :: View next topic » 
Author Message
chauhangaurav
PostPosted: Wed May 22, 2013 9:18 pm    Post subject: Need Help to parse copybook having REDEFINES Reply with quote

Novice

Joined: 15 May 2013
Posts: 11

I created message defintiion by importing COBOL copybook definition, into message set project (WBIMB V7) - there are REDEFINES within copybook. Then I coded ESQL to create a CWF format message using this message set. But when creating the BITSTREAM during MQOutput, I get an error that choice is not allowed.

COPY Book Format :
01 IREQ-MESSAGE.
000600 02 IREQ-FIXED.
000700 03 IREQ-MSG-ID.
000800 04 IREQ-MSG-TYPE PICTURE X(4) VALUE 'IREQ'.
002500 04 IREQ-MSG-VERSION
002600 PICTURE X(2) VALUE '01'.
002700 04 IREQ-MSG-ROUTE
002800 REDEFINES IREQ-MSG-VERSION
002900 PICTURE X(2).
003000 04 FILLER PICTURE X(2) VALUE SPACES.
003100 03 IREQ-USER PICTURE X( VALUE SPACES.
003200 03 IREQ-AUTH-USER PICTURE X( VALUE SPACES.
003300 SKIP3
003400 EJECT


ESQL code:

SET OutputRoot.MRM.IREQ_MESSAGE.IREQ_FIXED.IREQ_MSG_ID.IREQ_MSG_TYPE='IREQ';
SET OutputRoot.MRM.IREQ_MESSAGE.IREQ_FIXED.IREQ_MSG_ID.IREQ_MSG_VERSION='01';

SET OutputRoot.MRM.IREQ_MESSAGE.IREQ_FIXED.IREQ_USER='abcdefgh';

SET OutputRoot.MRM.IREQ_MESSAGE.IREQ_FIXED.IREQ_AUTH_USER='abcdefgh';

Exception:

ParserException
File:CHARACTER:F:\build\S700_P\src\cpi\pwf\cwf\cwfcontext.cpp
Line:INTEGER:1233
Function:CHARACTER:CContext::writeChoice
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:5345
Text:CHARACTER:CWF Choice Element Not Allowed
Insert
Type:INTEGER:5
Text:CHARACTER:msg_IREQMESSAGE
Insert
Type:INTEGER:5
Text:CHARACTER:UNDEFINED


Please help how to resolve this
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu May 23, 2013 4:01 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Please post the full text of the error message. The exception list just gives the error code.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu May 23, 2013 4:50 am    Post subject: Re: Need Help to parse copybook having REDEFINES Reply with quote

Grand High Poobah

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

chauhangaurav wrote:
Please help how to resolve this


The COBOL REDEFINES verb allows 2 possible definitions to exist for the same data, so you can define 9 bytes of your data to be PIC X(9) or PIC 9(9).

WMB supports this by means of an xs:choice, which means you must select one choice and having selected one choice can't change your mind. I suspect the ESQL code you've posted is incomplete and at some other point in your logic you're refering to IREQ-MSG-ROUTE.

I could be wrong, in which case follow @kimbert's excellent advice.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu May 23, 2013 4:57 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Vitor is probably right.
chauhangaurav: you could probably have found the answer without our help if you had looked up the error message. Do you know how to do that?
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Jul 04, 2013 4:17 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Vitor (or anyone).

Can you please give an example of using xs:choice ?

What goes in the msg set and what goes in the ESQL?

I have a developer with a similar question regarding COBOL redefine and how to handle them.

He is trying to read a message though not write one.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jul 04, 2013 5:01 am    Post subject: Reply with quote

Grand High Poobah

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

zpat wrote:
Can you please give an example of using xs:choice ?


Import a copybook & you'll get an example

zpat wrote:
What goes in the msg set and what goes in the ESQL?


You can use the message set as the import wizard creates it. This will use a choice to express the redefines but that's of no interest to you or your developer.

In the ESQL your developer must determine (either at design time or via some ESQL) which data format the actual data on the wire conforms to. Having decided that, he must use the choice (i.e. the variable names on the REDEFINES) that matches that format. This will resolve the choice, and from that point only that leg can be used.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jul 04, 2013 5:18 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Vitor has explained how the MRM CWF parser handles REDEFINES and xs:choice. In DFDL, things are a little different.

The MRM parser never attempts to resolve the REDEFINES. The message flow logic is responsible for inspecting the data and deciding on which branch to take. The message flow author is responsible for
- understanding how the REDEFINES can be resolved
- adding that information into the message flow logic

The DFDL parser always attempts to resolve the REDEFINES. The information about how to resolve the REDEFINES is contained in the DFDL model, but is not available to the importer. The message flow author is responsible for
- understanding how the REDEFINES can be resolved
- adding that information into the DFDL schema

Typically, the REDEFINES is resolved by some tag or indicator field that is the field field in the REDEFINES. In these cases, a simple DFDL discriminator does the job nicely.
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Jul 04, 2013 5:40 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Thanks, unfortunately we are constrained to using WMB v7005 at this time.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jul 04, 2013 7:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

zpat wrote:
Thanks, unfortunately we are constrained to using WMB v7005 at this time.


to recap: the COBOL copybook importer turns a REDEFINEs into an MRM choice structure in the model. this choice is either resolved into a specific element by earlier parts of the model, if the model is constructed that way.

Or the choice has to be resolved in your code, by having your code specifically address one or the other option of the REDEFINE. At that point, the bitstream that represents the choice area is parsed into one specific choice in the logical message tree. The logical message tree is then locked into that choice.

TDS can resolve choices using various techniques, tags being a favorite. CWF can't usually resolve choices for you.
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Jul 04, 2013 9:31 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Thanks.

Presumably the developer could also construct several different message sets (one for each variant) and then select the one to use contextually during the flow (RCD node).
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jul 04, 2013 10:21 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

zpat wrote:
Thanks.

Presumably the developer could also construct several different message sets (one for each variant) and then select the one to use contextually during the flow (RCD node).


Yes, could. Potentially easier to use whatever part of the message is distinguishable as an aspect of the message definition, to allow it to resolve the choice.

More work and effort to make more than one message definition, and potentially more computation time as well - although that's probably shaving hairs either way.

More than one definition means that those definitions must have logically distinct names, which either leads to really long names or to non-meaningful names (MessageA-Field1IsString-Field5IsAdddress or MessageA1S5A, instead of just a single MessageA).
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Jul 05, 2013 12:37 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Presumably the developer could also construct several different message sets (one for each variant) and then select the one to use contextually during the flow (RCD node).
I'm agreeing with mqjeff. The logic that selects the correct variant would be the same logic as would be required in the ESQL. The auto-resolution of choices is actually very elegant - you just work out which branch you want and access it. Behind the scenes, the MRM parser says 'aha, so that's the branch you want. I'll now parse the data and give you the contents of that branch'.

DFDL is even cleaner - the information about how to resolve the choice goes into the DFDL schema, and the message flow is presented with a fully-parsed message tree.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jul 05, 2013 1:28 am    Post subject: Reply with quote

Grand High Poobah

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

kimbert wrote:
DFDL is even cleaner - the information about how to resolve the choice goes into the DFDL schema, and the message flow is presented with a fully-parsed message tree.




Another reason to upgrade & obtain the glory that is the DFDL domain.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Jul 05, 2013 1:55 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Stick it in fixpack 7.0.0.6 and I would love to....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Need Help to parse copybook having REDEFINES
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.