Author |
Message
|
alethea |
Posted: Mon Sep 30, 2013 1:48 am Post subject: |
|
|
Apprentice
Joined: 30 Jul 2007 Posts: 45
|
alethea wrote: |
Once the msg comes out of SAPInput Node from SAP its structure is:
--Properties
-- Msgset --<Value>
--Transactional--true
--DataObject
--SAPGenericIdocObject
--SAPTransactionId
--IDocStreamData
--IDocType
--LocalEnvironment
|
1.--Properties
a. --Msgset --<Value>
b. --Transactional--true
2.--DataObject
a.--SAPGenericIdocObject
i.--SAPTransactionId
ii--IDocStreamData
iii--IDocType
3.--LocalEnvironment |
|
Back to top |
|
 |
dogorsy |
Posted: Mon Sep 30, 2013 2:48 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
You were given a few pointers already ( if not the solution ). Now you need to add a compute node and write some esql. try it out and see what you get. |
|
Back to top |
|
 |
alethea |
Posted: Mon Sep 30, 2013 5:09 am Post subject: |
|
|
Apprentice
Joined: 30 Jul 2007 Posts: 45
|
dogorsy wrote: |
You were given a few pointers already ( if not the solution ). Now you need to add a compute node and write some esql. try it out and see what you get. |
Say if I add a compute node after the SAPInput Node and first cast the data to blob and then cast the blob data to char ,
can you please tell me what CCSID i should use in blob to char casting
(I am not getting desired result with 1208 and I am not getting any CCSID in MQMD when msg enters in this compute node) |
|
Back to top |
|
 |
dogorsy |
Posted: Mon Sep 30, 2013 5:18 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
alethea wrote: |
first cast the data to blob |
have you been reading previous posts ?... why are you casting to blob ?, I gave you the solution, just read it. And yes, 1208 seems the right CCSID
Quote: |
I agree with using ESQL, but it is even simpler than that:
Code:
DECLARE myBlob BLOB InputRoot.XMLMSC...whatever...IDocStreamData;
( The line above does an implicit CAST from char to blob ),
and then CAST myBlob to char , with the correct CCSID ... for the OP to work it out. |
Last edited by dogorsy on Mon Sep 30, 2013 5:20 am; edited 1 time in total |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Sep 30, 2013 5:19 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
alethea wrote: |
dogorsy wrote: |
You were given a few pointers already ( if not the solution ). Now you need to add a compute node and write some esql. try it out and see what you get. |
Say if I add a compute node after the SAPInput Node and first cast the data to blob and then cast the blob data to char ,
can you please tell me what CCSID i should use in blob to char casting
(I am not getting desired result with 1208 and I am not getting any CCSID in MQMD when msg enters in this compute node) |
Its not as simple as casting a blob to char. The incoming CCSID is in the Root.Properties folder if you want to try it. But you won't get the result you expect. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
alethea |
Posted: Mon Sep 30, 2013 5:36 am Post subject: |
|
|
Apprentice
Joined: 30 Jul 2007 Posts: 45
|
lancelotlinc wrote: |
Its not as simple as casting a blob to char. The incoming CCSID is in the Root.Properties folder if you want to try it. But you won't get the result you expect. |
You are right. Its not that simple. I just wanted to tell that I have tried the pointers. One more thing, I dont have CCSID coming in from properties.
I have only Msgset and Transactional two values coming in properties, once the msg comes out of SAPInput node and ready to go to the compute node.
1.--Properties
a. --Msgset --<Value>
b. --Transactional--true
2.--DataObject
a.--SAPGenericIdocObject
i.--SAPTransactionId
ii--IDocStreamData
iii--IDocType
3.--LocalEnvironment |
|
Back to top |
|
 |
dogorsy |
Posted: Mon Sep 30, 2013 5:39 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
alethea wrote: |
Its not that simple. |
Yes, it is that simple. I have posted you the solution and the correct CCSID !
Input message , which is the sample data you posted:
Code: |
<testMsg>
<blob>4544495f444334302020303130303030</blob>
</testMsg> |
some ESQL ( you work it out, you need to do some work yourself ! ).
proof that it works:
Code: |
2013-09-30 14:44:54.466900 8344 UserTrace BIP2537I: Node 'testDFDL.Compute': Executing statement ''DECLARE myblob BLOB InputRoot.XMLNSC.testMsg.blob;'' at ('.testDFDL_Compute.Main', '6.3').
2013-09-30 14:44:54.477716 8344 UserTrace BIP2539I: Node '': Evaluating expression ''InputRoot.XMLNSC.testMsg.blob'' at ('.testDFDL_Compute.Main', '6.23'). This resolved to ''InputRoot.XMLNSC.testMsg.blob''. The result was '''4544495f444334302020303130303030'''.
2013-09-30 14:44:54.477840 8344 UserTrace BIP2537I: Node 'testDFDL.Compute': Executing statement ''SET OutputRoot.XMLNSC.Data.a = CAST(myblob etc);'' at ('.testDFDL_Compute.Main', '7.3').
2013-09-30 14:44:54.477856 8344 UserTrace BIP2539I: Node '': Evaluating expression ''myblob'' at ('.testDFDL_Compute.Main', '7.39'). This resolved to ''myblob''. The result was ''X'4544495f444334302020303130303030'''.
2013-09-30 14:44:54.477880 8344 UserTrace BIP2539I: Node '': Evaluating expression ''CAST(myblob etc)'' at ('.testDFDL_Compute.Main', '7.34'). This resolved to ''CAST(X'4544495f444334302020303130303030' etc )''. The result was '''EDI_DC40 010000'''.
2013-09-30 14:44:54.477932 8344 UserTrace BIP2566I: Node 'testDFDL.Compute': Assigning value '''EDI_DC40 010000''' to field / variable ''OutputRoot.XMLNSC.Data.a''.
|
Two lines of ESQL code, what is not simple about that ? |
|
Back to top |
|
 |
kimbert |
Posted: Mon Sep 30, 2013 7:02 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have posted you the solution and the correct CCSID ! |
Hmmm. I wonder...
Yesterday, rekarm01 pointed out that the CCSID required when CASTing from BLOB to CHARACTER is not necessarily the same as InputRoot.Properties.CodedCharSetId. I agree. If I was the sender, I would have included an 'encoding' attribute on the IDocStreamData tag.
alethea: Has the sender provided any information about the encoding of the text in IDocStreamData? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
alethea |
Posted: Mon Sep 30, 2013 5:00 pm Post subject: |
|
|
Apprentice
Joined: 30 Jul 2007 Posts: 45
|
kimbert wrote: |
Quote: |
I have posted you the solution and the correct CCSID ! |
Hmmm. I wonder...
Yesterday, rekarm01 pointed out that the CCSID required when CASTing from BLOB to CHARACTER is not necessarily the same as InputRoot.Properties.CodedCharSetId. I agree. If I was the sender, I would have included an 'encoding' attribute on the IDocStreamData tag.
alethea: Has the sender provided any information about the encoding of the text in IDocStreamData? |
No Kimbert. Encoding info of IDocStreamData is not provided.
I have found out that 912 works fine for this. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 01, 2013 12:18 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have found out that 912 works fine for this. |
That sounds like the wrong approach. How did you find this out? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
mapa |
Posted: Wed Oct 02, 2013 10:06 am Post subject: |
|
|
 Master
Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden
|
There is a built in pattern with the toolkit for this and you can read about it in Infocenter V7 - Generic IDOC routing
We actually have a RAD broker that just sends generic IDOCs to the main brokers.
There I have a publish flow that uses ESQL like this to extract the "real" IDOC into a message that a MQInputNode then can parse into a DataObject which is more or less the same as XMLNSC in this case.
Code: |
SET OutputRoot.MQMD = InputRoot.MQMD;
SET OutputRoot.MQMD.Format = MQFMT_STRING;
SET OutputRoot.MQMD.CodedCharSetId = 819;
SET OutputRoot.BLOB.BLOB = CAST(InputRoot.XMLNSC.sap:SapGenericIDocObject.IDocStreamData AS BLOB);
|
I use the InputRoot.XMLNSC.sap:SapGenericIDocObject.IDocType as part of the topic that I publish to.
If you do generate the pattern "Data distribution SAP to WebSphere MQ: one-way (for IDoc) pattern" in the toolkit you get a JCN that does in Java more or less the same as I do with the ESQL above. |
|
Back to top |
|
 |
dogorsy |
Posted: Wed Oct 02, 2013 11:10 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
mapa wrote: |
There is a built in pattern with the toolkit for this and you can read about it in Infocenter V7 - Generic IDOC routing
We actually have a RAD broker that just sends generic IDOCs to the main brokers.
There I have a publish flow that uses ESQL like this to extract the "real" IDOC into a message that a MQInputNode then can parse into a DataObject which is more or less the same as XMLNSC in this case.
Code: |
SET OutputRoot.MQMD = InputRoot.MQMD;
SET OutputRoot.MQMD.Format = MQFMT_STRING;
SET OutputRoot.MQMD.CodedCharSetId = 819;
SET OutputRoot.BLOB.BLOB = CAST(InputRoot.XMLNSC.sap:SapGenericIDocObject.IDocStreamData AS BLOB);
|
I use the InputRoot.XMLNSC.sap:SapGenericIDocObject.IDocType as part of the topic that I publish to.
If you do generate the pattern "Data distribution SAP to WebSphere MQ: one-way (for IDoc) pattern" in the toolkit you get a JCN that does in Java more or less the same as I do with the ESQL above. |
ok, yes, I have had disagreements with kimbert, most of the time he is right, but we have had some good constructive discussions on a few points ( which I consider to be very healthy , unless your big ego gets in the way). Now, I don't understand your point, how setting the ccsid to a fixed value is good ?
The OP has already coded something that "works", and as you can see, the word works is enclosed in quotes, the OP has coded all the right ESQL, the only remaining question is what CCSID to use. So maybe you should elaborate on why, how, your code should work ? I have supplied an user trace that shows the two lines of code that work ( for CCSID 1208, which is the one I used , it may not be the right one, I admit, as kimbert pointed out ), but it is a good starting point. The OP also found a CCSID that works ( for one case, it may not work for everything )... so she needs to ask/ find out what CCSID the data is encoded into. |
|
Back to top |
|
 |
mapa |
Posted: Wed Oct 02, 2013 11:33 am Post subject: |
|
|
 Master
Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden
|
I was just trying to point out that there is documentation and code for this provided out-of-the-box regarding how to handle SAP Generic IDOCs.
The problem is as you now know that the CCSID is unknown, the data from the SAPInputNode contains no information what-so-ever regarding the codepage of the IDocStreamData. You will have to know how you have configured the SAPAdapter to get this correct. Making sure it is UTF-8 is of course the safe choice.
Normally you would have the information in the headers and/or properties and should not hardcode it in the way I did in the code I pasted.
Regarding the code I just happend to have working code with (the full path to the IDocStreamData but maybe that did not bring any clarity but the opposite since the main problem was solved already).
I am doubtful that you actually do want to include an IDOC embedded in the XML message as plain text since it is a flatfile format in itself. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Oct 03, 2013 3:01 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have had disagreements with kimbert, most of the time he is right, but we have had some good constructive discussions on a few points |
I agree - that's my experience too.
Quote: |
The problem is as you now know that the CCSID is unknown |
I would say 'not supplied with the data' rather than 'unknown'. I bet somebody knows what the CCSID is.
Quote: |
You will have to know how you have configured the SAPAdapter to get this correct. |
My point exactly.
Quote: |
Making sure it is UTF-8 is of course the safe choice. |
I agree. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
mapa |
Posted: Thu Oct 03, 2013 4:07 am Post subject: |
|
|
 Master
Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden
|
kimbert wrote: |
I would say 'not supplied with the data' rather than 'unknown'. I bet somebody knows what the CCSID is.
|
Good point. |
|
Back to top |
|
 |
|