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 » Accessing fields inside COBOL re-define

Post new topic  Reply to topic
 Accessing fields inside COBOL re-define « View previous topic :: View next topic » 
Author Message
KIT_INC
PostPosted: Wed Mar 21, 2012 9:11 am    Post subject: Accessing fields inside COBOL re-define Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

I am using WMB V7

I created a message definition by importing a cobol copy book like this
Code:
       01  T1MESSAGE.                                                   00000600
           03 T1-AA                      PIC X(02).                     00000700
           03 T1-BB                      PIC X(02).                     00000800
           03 T1-CC                      PIC X(08).                     00004200
           03 T1-REDCC REDEFINES T1-CC.                       00004300
               05  T1-C1                   PIC X(03).                   00004400
               05  FILLER                  PIC X(03).                   00004500
               05  T1-C2                   PIC X(01).                   00004610
               05  T1-C3                   PIC X(01).                   00004620
      /
I use a simple flow to test
MQInput --> Compute --> MQOutput

MQInput node has the message set and defintion specified.

The ESQL I used
Code:
 SET OutputRoot.XMLNSC.MSG.DATA1 = InputRoot.MRM.T1_AA;
 SET OutputRoot.XMLNSC.MSG.DATA2 = InputRoot.MRM.T1_BB;
 SET OutputRoot.XMLNSC.MSG.DATA3 = InputRoot.MRM.T1_CC;
 SET OutputRoot.XMLNSC.MSG.DATA7 = InputRoot.MRM.T1_REDCC.T1_C1;
 SET OutputRoot.XMLNSC.MSG.DATA8 = InputRoot.MRM.T1_REDCC.T1_C2;
 SET OutputRoot.XMLNSC.MSG.DATA9 = InputRoot.MRM.T1_REDCC.T1_C3;
My input message is 123456789abc

The output I got was
Code:
<MSG>
 <DATA1>12</DATA1>
 <DATA2>34</DATA2>
 <DATA3>56789abc</DATA3>
</MSG>
A user trace shows
Code:
(0x0100001B:Name+):MRM        = ( ['mrm' : 0x1f2c0790]
(0x0300000B:NameValue+ ):T1_AA = '12' (CHARACTER)
(0x0300000B:NameValue+ ):T1_BB = '34' (CHARACTER)
 UNRESOLVED CHOICE = X'3536373839616263'
          )
        ) 

Executing statement ''SET OutputRoot.XMLNSC.MSG.DATA7 = InputRoot.MRM.T1_REDCC.T1_C1;'' at ('.MY_MSG_COBOL2XML_MF_Compute.CopyEntireMessage', '9.3').
2012-03-21 12:52:15.547027 6260 UserTrace BIP2543I: Node 'MY_MSG_COBOL2XML_MF.Compute': ('.MY_MSG_COBOL2XML_MF_Compute.CopyEntireMessage', '9.37') : Failed to navigate to path element number '3' because it does not exist.


How can I access get the value inside the redefine ( e.g. T1_REDCC.T1_C1) ?
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Mar 21, 2012 9:23 am    Post subject: Reply with quote

Grand High Poobah

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

Check the report from the COBOL copybook importer & the message set. The REDEFINES should have been expressed as a choice & may not be called T1-REDCC. The user trace is clearly showing that the parser has insufficient information to pick which of the choice elements to use for the input.

WMBv61's importer did stutter a little with REDEFINES. Not tried it on v7 but the same may be happening.

Depending on how you're using the data, it may be simplest to manually remove the PIC X( 8 ) element and just have the structure in the message set.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Mar 21, 2012 9:54 am    Post subject: Reply with quote

Grand High Poobah

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

The other problem with redefines is that the broker maps them to a choice. It is not like in COBOL where you can access both forms at the same time.

At runtime you have to choose whether you want to access the primary form or the redefined form...

Tough Luck
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Mar 21, 2012 10:04 am    Post subject: Reply with quote

Grand High Poobah

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

fjb_saper wrote:
The other problem with redefines is that the broker maps them to a choice. It is not like in COBOL where you can access both forms at the same time.


Oooo.....well spotted! I've clearly gone from too little coffee to too much!

My most worthy associate is quite right; you're assigning T1.CC to DATA3. This means that T1.CC is the chosen element so T1-Cn don't exist as the error indicates.

So you can either access T1.CC or T1.REDCC and it's children. You can't access both.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
KIT_INC
PostPosted: Wed Mar 21, 2012 10:37 am    Post subject: Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

Thanks Vitor and fjb_saper. If I understand you correctly than, I either do
SET OutputRoot.XMLNSC.MSG.DATA3 = InputRoot.MRM.T1_CC; or
SET OutputRoot.XMLNSC.MSG.DATA7 = InputRoot.MRM.T1_REDCC.T1_C1;

Is this true for the entire ESQL module or just for a ESQL functin or procedure? For example in my logic I first need to get T1_C1 and later on I need to get T1_CC, can I split that into 2 ESQL procedures or functions and call them according to my need ?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Mar 21, 2012 10:42 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The choice is resolved at the first point of determination. After that, the logical message tree is fixed.

So you can access either one, up to the point that you access one or the other. Once you have accessed one of the choices you can no longer access the other choices.
Back to top
View user's profile Send private message
KIT_INC
PostPosted: Wed Mar 21, 2012 10:51 am    Post subject: Reply with quote

Knight

Joined: 25 Aug 2006
Posts: 589

Thanks mqjeff, I just tested it and what you say is correct. If I need to access it a different way, I need to use another compute node (i.e. the first compute node access T1_CC and the second compute node access REDCC.T1_C1..)
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 » Accessing fields inside COBOL re-define
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.