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 values under copybook REDEFINES

Post new topic  Reply to topic
 Accessing values under copybook REDEFINES « View previous topic :: View next topic » 
Author Message
Glass
PostPosted: Thu Jun 14, 2007 5:30 pm    Post subject: Accessing values under copybook REDEFINES Reply with quote

Acolyte

Joined: 02 Mar 2006
Posts: 56

Hi,

I am using WMB v2.1 and am having trouble acessing the value under REDEFINES. Here is my copybook:


01 CANCELRESPTOFRMT.
05 CANCELHEADER2 PIC X(1).
05 NOERROR.
08 CANCELMSG.
10 CANCELVENDORORDER PIC X(7).
05 ERROR REDEFINES NOERROR.
08 CANCELMSGERROR.
10 CANCELERRORSYSTEM PIC X(20).
10 CANCELERRORTXNAME PIC X(20).


My ESQL is as follow which is giving me an error:

IF (TRIM(SUBSTRING(CAST("InputRoot"."MRM"."CANCELHEADER2" AS CHARACTER) FROM 1 FOR 1)) = '0') THEN
SET VAL = LENGTH("InputRoot"."MRM"."NOERROR"."CANCELMSG"."CANCELVENDORORDER");
ELSE
SET VAL = LENGTH("InputRoot"."MRM"."ERROR"."CANCELMSGERROR"."CANCELERRORSYSTEM");
END IF;

Can somebody please tell me what is the correct way to access the values in redefines in ESQL? I don't have a problem accessing the value outside redifenes (CANCELHEADER2) in the IF statement.

Thanks
Back to top
View user's profile Send private message
Glass
PostPosted: Thu Jun 14, 2007 5:36 pm    Post subject: Reply with quote

Acolyte

Joined: 02 Mar 2006
Posts: 56

Sorry, the copybook did not format well in the earlier message.

Code:
01 CANCELRESPTOFRMT.
05 CANCELHEADER2 PIC X(1).
    05 NOERROR.
        08 CANCELMSG.
            10 CANCELVENDORORDER PIC X(7).
    05 ERROR REDEFINES NOERROR.
        08 CANCELMSGERROR.
            10 CANCELERRORSYSTEM PIC X(20).
            10 CANCELERRORTXNAME PIC X(20).
[/quote]
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Jun 14, 2007 6:43 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Um. 2.1? You need to concentrate on upgrading to v6.

It's possible you're out of luck with redefines in 2.1. It kind of depends.

Redefines turn into CHOICES in a message set. So you need to do something to resolve the choice at runtime. That should usually be done by just accessing the fields in the right order.

But I can't tell you what's wrong with what you're doing until you tell me what the error message you're getting is.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Glass
PostPosted: Thu Jun 14, 2007 9:55 pm    Post subject: Reply with quote

Acolyte

Joined: 02 Mar 2006
Posts: 56

Here is the error log:

Code:
2007-06-14 19:48:18.770598       61   UserTrace   BIP2538I: Node 'CancelRespToXML_S.CancelRespToXMLFlow1.OrdCancelRespMap1.MandatoryField': Evaluating
expression 'InputRoot.MRM.NOERROR.CANCELMSG.CANCELVENDORORDER' at (59, 28).
2007-06-14 19:48:18.773414       61   UserTrace   BIP2231E: Error detected whilst processing a message 'CancelRespToXML_S.CancelRespToXMLFlow1.OrdCance
lRespMap1.MandatoryField'.
                                       The message broker detected an error whilst processing a message in node 'CancelRespToXML_S.CancelRespToXMLFlow1.
OrdCancelRespMap1.MandatoryField'. The message has been augmented with an exception list and has been propagated to the node's failure terminal for further p
rocessing.
                                       See the following messages for details of the error.
2007-06-14 19:48:18.773498       61   ParserException  BIP5285E: Message Translation Interface Parsing Errors have occurred:
                                       Message Set Name  : 'MAINMSG'
                                       Message Set Level : '1'
                                       Message Format    : 'CWF'
                                       Message Type Path : 'CANCELRESPTOFRMT'
                                       Review further error messages for an indication to the cause of the errors.
2007-06-14 19:48:18.773528       61   ParserException  BIP5171E: Custom Wire Format parsing error
                                       An error occurred while parsing a Custom Wire Format message.
                                       Current message               : 'CANCELRESPTOFRMT'
                                       Current element               : 'CANCELRESPTOFRMT_GROUP001'
                                       Path from message root        : '/CANCELRESPTOFRMT'
                                       Offset from start of message  : 155
                                       See following errors for more details.
2007-06-14 19:48:18.773552       61   ParserException  BIP5181E: Custom Wire Format error. Message bitstream smaller than expected.
                                       Current element '0'.
                                       The bitstream is smaller than expected for a CWF message of this message type.
                                       Check that the input message is correctly structured, and has not been corrupted.
                                       Check the MRM definition of this message type.
                                       See following messages for more details.
2007-06-14 19:48:18.773908       61   UserTrace   BIP2538I: Node 'CancelRespToXML_S.Failure_CancelResp_Trace': Evaluating expression 'ExceptionList' a
t (3, 3).
2007-06-14 19:48:18.776842       61   UserTrace   BIP2538I: Node 'CancelRespToXML_S.Failure_CancelResp_Trace': Evaluating expression 'Body' at (5, 3).

2007-06-14 19:48:18.777066       61   UserTrace   BIP2538I: Node 'CancelRespToXML_S.Failure_CancelResp_Trace': Evaluating expression 'Root' at (7, 3).

2007-06-14 19:48:18.813772       61   UserTrace   BIP4067I: Message propagated to output terminal for trace node 'CancelRespToXML_S.Failure_CancelResp
_Trace'.



Regardless of the error, given the structure of my copybook, what whould be the ESQL code to access the items inside redefines?

Thanks!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jun 15, 2007 3:28 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Regardless of the error, the code used to access elements inside a redefine is the same as the code to access elements outside a redefine.

A redefine gets turned into a choice. Usually.

It looks like either your message set doesn't have a choice for the redefine, or something caused the wrong choice to be selected.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Glass
PostPosted: Fri Jun 15, 2007 7:22 am    Post subject: Reply with quote

Acolyte

Joined: 02 Mar 2006
Posts: 56

I have two Message Types, one for the redefine (Type Composition = Choice) and one for the 01 level, CANCELRESPTOFRMT_TYPE (Type Composition = Sequence). These were the default values. I tried changing the Type Composition of the main one from Sequence to Ordered Set, Unordered set etc but I get the same error.

You mentioned that my "message set" doesn't have a choice for the redefine. I could not see anyplace to change in the Message Set to make it Chioce. This option is there only for Message Type. Am I missing something?

Thanks
Back to top
View user's profile Send private message
EddieA
PostPosted: Fri Jun 15, 2007 9:35 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

From memory, the problem with Choice, at least for 2.1, was that ALL choice elements had to be the same length.

Hence the bitstream is smaller than expected for a CWF message of this message type error when the "smaller" message is encountered.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Glass
PostPosted: Fri Jun 15, 2007 12:43 pm    Post subject: Reply with quote

Acolyte

Joined: 02 Mar 2006
Posts: 56

I think thats it. I tried a sample copybook and made both the entries in redefine the same length and it worked fine.

If anybody else has any other idea to get around this problem please let me know or else I need to have them upgrdage to 6.0.

Thanks for all the response!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Jun 15, 2007 2:29 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

No matter what, you need to have them upgrade to v6.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
shanson
PostPosted: Mon Jun 18, 2007 12:17 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

Moving to V6 on its own won't fix this. The rule about MRM CWF choice branches having to be the same length is still there. All that rule does is reflect the rules for C and COBOL memory layout for structures. There should really be FILLER PIC X(33) in CANCELMSG to make the branches the same length.

But in V6 you can use 'multipart messaging' instead. You have to refactor your copybook a bit to do this. You specify CANCELHEADER2 as a 'Message Identity'. You make CANCELMSG and CANCELMSGERROR into Messages with a 'Message Alias' set to the value of the CANCELHEADER2 field. The complex type with Composition 'Choice' should be changed to Composition 'Message'. The MRM parser uses all that to parse automatically the correct embedded message. The embedded messages don't have to be the same length.

If you are stuck with V2.1 then best approach is to initially treat the message as a BLOB. In ESQL you then interrogate the hex value of the first byte (remembering that it will be in its original code page), then you either use a pair of ESQL CREATE LAST CHILD ... PARSE ... statement or a pair of ResetContentDescriptor nodes, one per message variant. Again you will need to refactor your message, this time into 2 messages, one for each variant.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jun 18, 2007 12:24 am    Post subject: Reply with quote

Grand High Poobah

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

shanson wrote:
Moving to V6 on its own won't fix this.


But it will fix a multitude of other problems, not least of which using out of support software and that wretched GUI!

(Sorry, projecting my own prejudices there, I'm sure many people think it's a nice GUI, they are of course fully entitled to their opinions. And access to mental health professionals).
_________________
Honesty is the best policy.
Insanity is the best defence.
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 values under copybook 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.