Author |
Message
|
dilse |
Posted: Mon Sep 19, 2005 10:14 am Post subject: REDEFINES for BLOB to MRM conversion |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Hi Guys,
I am converting the incoming BLOB into MRM(CWF) format and then I am converting this CWF to XML as output.. I have couple of REDEFINES clauses in my copybook like this.
05 String PIC X(10).
05 String1 REDEFINES String.
10 SubString11 PIC X(5).
10 SubString12 PIC X(5).
05 String2 REDEFINES String.
10 SubString2 PIC X(10).
When I imported this COBOL Copybook into my message set, it created one choice element for these three fields(String, String1, String2).
I am reading my input as BLOB and I am parsing this to the above copybook message definition. The problem now is, how to handle the choice element sothat it should choose the correct choice. How do I ESQL this procedure? Please someone point me in the right direction.
I tried to search in this site and even in the manuals but I didn't get much on this. How will the broker know as to which "choice" it needs to resolve? Do I have to parse the incoming BLOB and find out which does it belong to? If that is the case which value do I need to assign for the choice variable if there are 3 choices.
Any input would be helpful.
Thanks, _________________ DilSe..
Take life as it comes.. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Sep 19, 2005 10:17 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The only way the broker knows which choice to use is if you have a tag or a data pattern configured on the message set, that the broker can use to resolve the choice.
Otherwise, the choice is resolved by your ESQL. That is, if you access InputBody.String1, then it will parse the data that way. If you access InputBody.String, then it will parse the data that way instead. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dilse |
Posted: Mon Sep 19, 2005 10:41 am Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Thanks for your reply Jeff. I have one more question.
Quote: |
The only way the broker knows which choice to use is if you have a tag or a data pattern configured on the message set, that the broker can use to resolve the choice. |
If I have a tag, How do I configure in the message set??
And if I want to do it in the ESQL, How can I code ESQL to resolve it to the String1.
Lets say if the first charcters are equal to "abcde" then I have to choose String1 else String2. How should I code in ESQL for this scenario in order for the broker to resolve it to String1? Please let me know.
Thanks _________________ DilSe..
Take life as it comes.. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Sep 19, 2005 11:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You'd have to model the data using TDS to set up a tag or a data pattern. Then you wouldn't read it using BLOB, you'd read it using the MRM.
You can code an IF statement to determine if the first characters are "abcde". Then you can code ESQL that sets or reads the fields of the choice one way or the other.
Something vaguely like
Code: |
IF SUBSTRING(InputRoot.BLOB.BLOB from 0 for 5)="abcde" then
Set OutputRoot.MRM.String = Substring(InputRoot.BLOB.BLOB from 0 for 10);
else
Set OutputRoot.MRM.String1.String11 = Substring(InputRoot.BLOB.BLOB from 0 for 5);
Set OutputRoot.MRM.String1.String12 = Substring(InputRoot.BLOB.BLOB from 6 for 5);
end if |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
EddieA |
Posted: Mon Sep 19, 2005 11:07 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
And if I want to do it in the ESQL, How can I code ESQL to resolve it to the String1. |
Code: |
If 1st 5 chars of String = abcde then
refer to String1, SubString11, or 12 in your ESQL
else
refer to SubString2 in your ESQL
end if. |
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Sep 19, 2005 11:08 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You'd have to model the data using TDS to set up a tag or a data pattern. Then you wouldn't read it using BLOB, you'd read it using the MRM.
You can code an IF statement to determine if the first characters are "abcde". Then you can code ESQL that sets or reads the fields of the choice one way or the other.
Something vaguely like
Code: |
IF SUBSTRING(InputRoot.BLOB.BLOB from 0 for 5)="abcde" then
Set OutputRoot.MRM.String = Substring(InputRoot.BLOB.BLOB from 0 for 10);
else
Set OutputRoot.MRM.String1.String11 = Substring(InputRoot.BLOB.BLOB from 0 for 5);
Set OutputRoot.MRM.String1.String12 = Substring(InputRoot.BLOB.BLOB from 6 for 5);
end if |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dilse |
Posted: Mon Sep 19, 2005 11:11 am Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Thanks a lot Jeff and Eddie for your valuable inputs. I will try it in ESQL and Will let you know if I see any issue. Thanks a lot once again.
Thanks _________________ DilSe..
Take life as it comes.. |
|
Back to top |
|
 |
dilse |
Posted: Mon Sep 19, 2005 1:08 pm Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
One last question:
Do I need put this code before I parse the BLOB or can I call this after parsing the BLOB into MRM. Please let me know.
Thanks _________________ DilSe..
Take life as it comes.. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Sep 19, 2005 2:46 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can do it after the RCD. The choice doesn't get resolved until it's resolved, if you see what I mean.
But it might get harder to do if you need to use parts of the message that may end up resolving the choices, in order to resolve the choices. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dilse |
Posted: Tue Sep 20, 2005 5:58 am Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Thanks a lot Jeff. _________________ DilSe..
Take life as it comes.. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Sep 21, 2005 12:33 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
dilse,
Just to confirm that Eddie and Jefff are absolutely correct. The CWF parser cannot possibly resolve a choice on its own, so it simply puts the raw bitstream (just the part relating to the choice) into the tree. You can then write ESQL which accesses the correct branch of the choice, and the CWF parser will automatically kick in and resolve the choice to your selected branch. |
|
Back to top |
|
 |
dilse |
Posted: Wed Sep 21, 2005 6:48 am Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Thanks for the info Kimbert . I think I got it. _________________ DilSe..
Take life as it comes.. |
|
Back to top |
|
 |
|