Author |
Message
|
hornbeam123 |
Posted: Tue Dec 07, 2004 9:57 am Post subject: using mrm maxlength at runtime |
|
|
Centurion
Joined: 01 Nov 2003 Posts: 101
|
Background
Incoming xml occassionally exceeds maximum length defined on an output mrm element.
ESQL as below works :
--if input BuyersOrderNumber is >14 (length of MAI_PO_NUMBER) then set
--to string "Invalid PO", this is instead of MRM failing and message going to failQ.
DECLARE LengthOfBuyersOrderNumber INT ;
SET LengthOfBuyersOrderNumber = LENGTH(InputBody.Invoice.InvoiceReferences.BuyersOrderNumber);
IF LengthOfBuyersOrderNumber > 14
THEN SET OutputRoot.MRM."MAI_PO_NUMBER_id" = 'Invalid PO' ;
But I am having to hardcode the length (14) in the esql, no good if somebody changes element
maxlength in future and forgets to check esql.
So can I at runtime get to this mrm defined maxlength ? e.g. something like LENGTH(.......MRM."MAI_PO_NUMBER_id").
Bet I can guess the answer.
Btw its good old MQSI 2.1.
We will be moving to v5 over next year any change in this area ? |
|
Back to top |
|
 |
JT |
Posted: Tue Dec 07, 2004 10:13 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
|
Back to top |
|
 |
hornbeam123 |
Posted: Tue Dec 07, 2004 1:07 pm Post subject: using mrm maxlength at runtime |
|
|
Centurion
Joined: 01 Nov 2003 Posts: 101
|
I've read the thread which clearly states my problem and regrettably does not offer a workable solution, so hardcoded length checks in my esql will have to continue. This is a deficiency in MQSI in my view, in not being able to interrogate target lengths directly that are held in the mrm.
Glad my flow has only about six xml input fields that are mapped directly to fixed length outputs. If you had five times that amount what a maintenance headache.
Never mind at least I know where I stand, thanks for your help. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Dec 07, 2004 1:22 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You could greatly simplify the maintenance headache by putting a compute node at the start of the message flow. It's only job would be to set Environment or LocalEnvironment field length constants.
Then when a field length changed, change the value of the constant rather than having to change ESQL in many places. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Tue Dec 07, 2004 1:25 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
I'm sure it's of no comfort to you, but I too have been bit by this deficiency (and judging by previous posts to this forum, so too have a few other WBIMB users). |
|
Back to top |
|
 |
kirani |
Posted: Tue Dec 07, 2004 11:49 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Have you tried defining Invalid PO as a default value for MAI_PO_NUMBER_id MRM element instead? I have not tried this before so I am not sure if this would work. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
wooda |
Posted: Wed Dec 08, 2004 5:15 am Post subject: |
|
|
 Master
Joined: 21 Nov 2003 Posts: 265 Location: UK
|
kirani -
FYI : default value will not work since they are never used in MRM XML. |
|
Back to top |
|
 |
kirani |
Posted: Wed Dec 08, 2004 10:46 am Post subject: Re: using mrm maxlength at runtime |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
His input is XML and output is MRM-CWF. Look at his comments,
hornbeam123 wrote: |
Glad my flow has only about six xml input fields that are mapped directly to fixed length outputs. |
_________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
hornbeam123 |
Posted: Wed Dec 08, 2004 1:11 pm Post subject: using mrm maxlength at runtime |
|
|
Centurion
Joined: 01 Nov 2003 Posts: 101
|
The output is CSV format using MRM TDS. The field in question along with several others is String with a maxlength defined. So far only this field can have such an alternate value applied when length exceeds the input specification.
The problem for us is that the suppliers of the xml (third-party) do occassionally create the input incorrectly. I'm inclined to check the lengths of the other relevant inputs and throw a meaningful exception - better than message going to failQ without any explanation (otherwise replaying message with trace would be the only way we find out what value is wrong, unless we can recognise the problem from inspection of the input).
Defining the constants as Jeff suggests, in environment and a preceding compute node, I agree would ease maintenance by avoiding having to plough through potentially complicated logic, however in our case the input field is only referenced one time and in only one flow. You would still have to remember to visit this new 'constants' node and change any constants each time you changed the mrm element definition.
It would be much better, as we all seem to agree, if we could just get to the mrm values explicitly. |
|
Back to top |
|
 |
bobbee |
Posted: Mon Apr 04, 2005 8:41 am Post subject: |
|
|
 Knight
Joined: 20 Sep 2001 Posts: 545 Location: Tampa
|
My issue is I have CWF incoming and CWF outgoing. It would be nice to see the TOTAL size of the MessageType and Elements prior to my reading and parsing them. ou caan do this in COBOL!!
I don't know if it has been requested but I am going to try to put up an official request with IBM. I will get back on the HOW. I believe that if enough people request an upgrade/fix and it seems worthwhile IBM will move on it and attempt to implement it(WHEN????).
bobbee |
|
Back to top |
|
 |
|