Author |
Message
|
alouie |
Posted: Mon Jul 28, 2003 7:54 am Post subject: Problem mapping XML attribute to COBOL |
|
|
Newbie
Joined: 31 May 2001 Posts: 5 Location: Guardian Life Insurance Company
|
I'm having a problem when mapping an XML attribute to a COBOL field. No error messages appear in the usertrace or event viewer but the value never appears in the COBOL field. Three values come in but only 2 go out.
Has anyone else encountered this or a similiar situation? Could it be the way I'm referencing the XML attribute? (Note the use of the @ sign to prefix the attribute name, this is how it appears in the MRM tree in the debugger. If I don't prefix the attribute name with the @ sign, I get the error message "Failed to navigate to path element because it does not exist." in the usertrace.
As a sidenote, I discovered that MQSI does not like XML elements with attributes and values (even though this appears to be well-formed XML) so I had to restructure the DTD/XML so the parent tag as the attribute and a child tag has the value. Any thoughts on this?
I'm using 2 message sets, one for XML and one for COBOL. The XML message is created by importing a DTD.
Here is the DTD input:
Code: |
<!ELEMENT endangered_species (animal)+>
<!ELEMENT animal (animal_name, threats)>
<!ELEMENT animal_name (name)>
<!ATTLIST animal_name language (English | Latin) #REQUIRED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT threats (#PCDATA)>
|
Here is the XML input:
Code: |
<endangered_species>
<animal>
<animal_name language="English">
<name>Tiger</name>
</animal_name>
<threats>none</threats>
</animal>
</endangered_species>
|
Here is the COBOL copybook:
Code: |
01 ENDANGERED-SPECIES-COB.
05 ANIMAL-COB.
10 LANGUAGE-COB PIC X(20) VALUES SPACES.
10 NAME-COB PIC X(20) VALUES SPACES.
10 THREATS-COB PIC X(50) VALUES SPACES.
|
Finally, here is the ESQL:
Code: |
DECLARE C INTEGER;
SET C = CARDINALITY(InputRoot.*[]);
DECLARE I INTEGER;
SET I = 1;
WHILE I < C DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
SET OutputRoot.Properties.MessageSet = 'DODHVHO08U001';
SET OutputRoot.Properties.MessageType = 'ENDANGERED_SPECIES';
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
SET "OutputRoot"."MRM"."ANIMAL_COB"."LANGUAGE_COB" = "InputBody"."animal"."animal_name"."@language";
SET "OutputRoot"."MRM"."ANIMAL_COB"."NAME_COB" = "InputBody"."animal"."animal_name"."name";
SET "OutputRoot"."MRM"."ANIMAL_COB"."THREATS_COB" = "InputBody"."animal"."threats";
SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageFormat = 'CWF';
|
Any help would be greatly appreciated. TIA |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 28, 2003 8:34 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Maybe I'm missing something, but I think you need to use "OutputRoot.MRM.ENDANDGERED_SPECIES_COB.ANIMAL_COB" and "InputRoot.XML.endangered_species.animal" (or "InputBody.endangered_species.animal") instead of what you have.
Also, it would be helpful to see what the logical message tree looks like after your ESQL has run (i.e. a trace output). |
|
Back to top |
|
 |
alouie |
Posted: Mon Jul 28, 2003 9:37 am Post subject: |
|
|
Newbie
Joined: 31 May 2001 Posts: 5 Location: Guardian Life Insurance Company
|
Jeff.
I tried the change you suggested but each set statement generated the "Failed to navigate to path element because it does not exist." error message.
I should have stated that the set statements I'm using were generated by the drag and drop mapping. I moved them below the comment line and added the @ sign after looking at the MRM tree in the debugger. BTW, they didn't work above the comment line either.
Here is the message tree before the compute node:
Code: |
(
(0x1000000)Properties = (
(0x3000000)MessageSet = 'DSUH9140KK001'
(0x3000000)MessageType = 'endangered_species'
(0x3000000)MessageFormat = 'XML'
(0x3000000)Encoding = 546
(0x3000000)CodedCharSetId = 437
(0x3000000)Transactional = TRUE
(0x3000000)Persistence = FALSE
(0x3000000)CreationTime = GMTTIMESTAMP '2003-07-28 17:29:36.110'
(0x3000000)ExpirationTime = -1
(0x3000000)Priority = 0
(0x3000000)ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x3000000)ReplyProtocol = 'MQ'
(0x3000000)Topic = NULL
)
(0x1000000)MQMD = (
(0x3000000)SourceQueue = 'AL_XML_IN_DTD_9'
(0x3000000)Transactional = TRUE
(0x3000000)Encoding = 546
(0x3000000)CodedCharSetId = 437
(0x3000000)Format = ' '
(0x3000000)Version = 2
(0x3000000)Report = 0
(0x3000000)MsgType = 8
(0x3000000)Expiry = -1
(0x3000000)Feedback = 0
(0x3000000)Priority = 0
(0x3000000)Persistence = 0
(0x3000000)MsgId = X'414d51204d5153495632202020202020c657f83e12b04b0c'
(0x3000000)CorrelId = X'000000000000000000000000000000000000000000000000'
(0x3000000)BackoutCount = 0
(0x3000000)ReplyToQ = ' '
(0x3000000)ReplyToQMgr = 'MQSIV2 '
(0x3000000)UserIdentifier = 'NSDLAXL '
(0x3000000)AccountingToken = X'16010515000000755df67e8640542f646189379209000000000000000000000b'
(0x3000000)ApplIdentityData = ' '
(0x3000000)PutApplType = 11
(0x3000000)PutApplName = ':\MQSIDebugTools\RFHUTIL.EXE'
(0x3000000)PutDate = DATE '2003-07-28'
(0x3000000)PutTime = GMTTIME '17:29:36.110'
(0x3000000)ApplOriginData = ' '
(0x3000000)GroupId = X'000000000000000000000000000000000000000000000000'
(0x3000000)MsgSeqNumber = 1
(0x3000000)Offset = 0
(0x3000000)MsgFlags = 0
(0x3000000)OriginalLength = -1
)
(0x1000021)MRM = (
(0x1000013)animal = (
(0x1000015)animal_name = (
(0x300000D)@language = 'English'
(0x3000013)name = 'Tiger'
)
(0x300000B)threats = 'none'
)
)
)
|
Here is the message tree after the compute node:
Code: |
(
(0x1000000)Properties = (
(0x3000000)MessageSet = 'DODHVHO08U001'
(0x3000000)MessageType = 'ENDANGERED_SPECIES'
(0x3000000)MessageFormat = 'CWF'
(0x3000000)Encoding = 546
(0x3000000)CodedCharSetId = 437
(0x3000000)Transactional = TRUE
(0x3000000)Persistence = FALSE
(0x3000000)CreationTime = GMTTIMESTAMP '2003-07-28 17:29:36.110'
(0x3000000)ExpirationTime = -1
(0x3000000)Priority = 0
(0x3000000)ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x3000000)ReplyProtocol = 'MQ'
(0x3000000)Topic = NULL
)
(0x1000000)MQMD = (
(0x3000000)SourceQueue = 'AL_XML_IN_DTD_9'
(0x3000000)Transactional = TRUE
(0x3000000)Encoding = 546
(0x3000000)CodedCharSetId = 437
(0x3000000)Format = ' '
(0x3000000)Version = 2
(0x3000000)Report = 0
(0x3000000)MsgType = 8
(0x3000000)Expiry = -1
(0x3000000)Feedback = 0
(0x3000000)Priority = 0
(0x3000000)Persistence = 0
(0x3000000)MsgId = X'414d51204d5153495632202020202020c657f83e12b04b0c'
(0x3000000)CorrelId = X'000000000000000000000000000000000000000000000000'
(0x3000000)BackoutCount = 0
(0x3000000)ReplyToQ = ' '
(0x3000000)ReplyToQMgr = 'MQSIV2 '
(0x3000000)UserIdentifier = 'NSDLAXL '
(0x3000000)AccountingToken = X'16010515000000755df67e8640542f646189379209000000000000000000000b'
(0x3000000)ApplIdentityData = ' '
(0x3000000)PutApplType = 11
(0x3000000)PutApplName = ':\MQSIDebugTools\RFHUTIL.EXE'
(0x3000000)PutDate = DATE '2003-07-28'
(0x3000000)PutTime = GMTTIME '17:29:36.110'
(0x3000000)ApplOriginData = ' '
(0x3000000)GroupId = X'000000000000000000000000000000000000000000000000'
(0x3000000)MsgSeqNumber = 1
(0x3000000)Offset = 0
(0x3000000)MsgFlags = 0
(0x3000000)OriginalLength = -1
)
(0x1000021)MRM = (
(0x1000000)ANIMAL_COB = (
(0x300000D)LANGUAGE_COB = 'English'
(0x3000013)NAME_COB = 'Tiger'
(0x300000B)THREATS_COB = 'none'
)
)
)
|
Here is the output data mapped to the COBOL copybook:
Code: |
Level Ofs Len Type Occ Variable Name Value
01 0 90 ENDANGERED-SPECIES-COB
05 0 90 ANIMAL-COB
10 0 20 CHAR LANGUAGE-COB
10 20 20 CHAR NAME-COB Tiger
10 40 50 CHAR THREATS-COB none
Copy book size 90, Data area size 90 |
Note the absence of a value for LANGUAGE-COB. Any ideas?
Anthony |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 28, 2003 10:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Quote: |
I should have stated that the set statements I'm using were generated by the drag and drop mapping. |
Well, then I guess they seem correct. Although it strikes me as rather odd.
Quote: |
Note the absence of a value for LANGUAGE-COB. Any ideas? |
Is the second trace file you showed from directly before your MQOutputNode?
Are you having to do character conversion between your WMQI output message and your cobol program (i.e ASCII to EBCIDIC?) - if so, how is that being handled?
I'm still very confused that your model specifies ENDANGERED_SPECIES_COB as the root element, but it doesn't seem to be used. |
|
Back to top |
|
 |
alouie |
Posted: Mon Jul 28, 2003 10:29 am Post subject: |
|
|
Newbie
Joined: 31 May 2001 Posts: 5 Location: Guardian Life Insurance Company
|
Quote: |
Is the second trace file you showed from directly before your MQOutputNode?
|
Yes
Quote: |
Are you having to do character conversion between your WMQI output message and your cobol program (i.e ASCII to EBCIDIC?) - if so, how is that being handled?
|
There is no conversion being done. The output node writes to a local queue.
Quote: |
I'm still very confused that your model specifies ENDANGERED_SPECIES_COB as the root element, but it doesn't seem to be used. |
I don't know what to say about this. I'm about as far from an WMQSI expert as you can get having only taken MQ660 (WMQ integrator workshop). I'm looking to broaden my mostly administrative background. Depending on your point of view, I picked either a very good or very poor example for this learning experience.
I do appreciate you taking your time with this Jeff.
Anthony |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 29, 2003 5:44 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I can shed some light on this...
The structure 'animal_name' and the attribute 'language' are being parsed as self-defining. In other words, the parser could not match them against the message model. This is why the attribute has the '@' sign on the front of its name, and is also the reason why 'LANGUAGE_COB' is not being output.
I suggest that you look carefully at the model which the DTD importer has created from your DTD.
1. You should see a message definition based on the complex type for 'endangered_species', with an XML name of 'endangered_species'. (if this is absent, then that is your problem)
2. At the message set level, the field 'Root tag name' in the XML properties should be empty.
3. In the XML settings for the element 'language' , the field labelled 'Member Render' should be set to 'XMLAttribute'.
Hope that helps. Let us know if the problem persists. |
|
Back to top |
|
 |
alouie |
Posted: Tue Jul 29, 2003 7:24 am Post subject: |
|
|
Newbie
Joined: 31 May 2001 Posts: 5 Location: Guardian Life Insurance Company
|
I reviewed your list and all was well with the message set. I discovered that the problem was that the message set id in the input node was incorrect. I had appended a small letter a when I created the most recent message set I was using but did not change the id in the input node. Once I did that, everything worked fine.
Thanks for all your responses.
Anthony |
|
Back to top |
|
 |
|