Author |
Message
|
LH33 |
Posted: Wed Aug 20, 2003 8:34 am Post subject: Indexes and Elements |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
I have a message flow that takes input XML that looks like the following:
<CreateJob environment="Test" revision="1.0.0">
<ApplicationArea>
<Sender>
<Component>OMS</Component>
<Confirmation>Always</Confirmation>
<AuthorizationId>OMS Interface</AuthorizationId>
</Sender>
<CreationDateTime>2003-08-11T09:50:03</CreationDateTime>
<BODId>{270F340A-6A8A-4572-A4EC-E7D7317F982C}</BODId>
</ApplicationArea>
<DataArea>
<Create confirm="Always"/>
<Job>
<ExternalNumbers>
<ExternalNumber index="1">OMS:500001</ExternalNumber>
</ExternalNumbers>
<ParentNumber/>
<Origin>OMS</Origin>
<AgencyCode>EOM</AgencyCode>
<TimeLine>
<CreationDateTime>2003-08-11T09:48:00</CreationDateTime>
<StartAfterDateTime>2003-08-11T09:50:03</StartAfterDateTime>
</TimeLine>
<UDFS>
<UDF index="5">4804</UDF>
<UDF index="6">30103200024</UDF>
<UDF index="7"/>
<UDF index="8">1</UDF>
<UDF index="9">OUT</UDF>
</UDFS>
<Filters>
<Filter index="1"/>
<Filter index="2">Front Street</Filter>
</Filters>
<Location>
<Address>
<Streets>
<Street index="1">
<Name>R 2418 W FRANKLIN ST</Name>
</Street>
</Streets>
<CityCode>-</CityCode>
</Address>
<Latitude>1.4099e+006</Latitude>
<Longitude>592746</Longitude>
<Customer>
<Name>Not Applicable</Name>
<Comment/>
<Address>
<FreeFormat/>
</Address>
</Customer>
<Phones>
<Phone index="1">
<Number/>
</Phone>
</Phones>
</Location>
<LevelCode5>3010320</LevelCode5>
<WorkCodeUDFS>
<WorkCodeUDF index="2">1</WorkCodeUDF>
<WorkCodeUDF index="3">PD</WorkCodeUDF> <WorkCodeUDF index="4">Protective Device</WorkCodeUDF>
<WorkCodeUDF index="5">A</WorkCodeUDF>
<WorkCodeUDF index="6">A</WorkCodeUDF>
<WorkCodeUDF index="7">0100</WorkCodeUDF>
<WorkCodeUDF index="8">1</WorkCodeUDF>
<WorkCodeUDF index="9">00000</WorkCodeUDF>
<WorkCodeUDF index="10"/>
<WorkCodeUDF index="56">ACK</WorkCodeUDF>
<WorkCodeUDF index="57">4804</WorkCodeUDF>
<WorkCodeUDF index="58">30103200024</WorkCodeUDF>
<WorkCodeUDF index="59">1</WorkCodeUDF>
<WorkCodeUDF index="60">0</WorkCodeUDF>
<WorkCodeUDF index="61">0</WorkCodeUDF>
<WorkCodeUDF index="62">0</WorkCodeUDF>
<WorkCodeUDF index="63"/>
<WorkCodeUDF index="74"/>
<WorkCodeUDF index="83">R 2418 W FRANKLIN ST</WorkCodeUDF>
<WorkCodeUDF index="84">1</WorkCodeUDF>
<WorkCodeUDF index="85">3500</WorkCodeUDF>
<WorkCodeUDF index="86">517860</WorkCodeUDF>
<WorkCodeUDF index="87">90</WorkCodeUDF>
<WorkCodeUDF index="88">62</WorkCodeUDF>
<WorkCodeUDF index="64">Not Applicable</WorkCodeUDF>
</WorkCodeUDFS>
</Job>
</DataArea>
</CreateJob>
I need to check the tag WorkCodeUDF index = 2 for a specific value. How do I check the tag for the element index = 2 to insure I get the right tag and value? If I say WorkCodeUDF index[2], it gives me the value in the bolded tag above since WorkCode index[1] is not present in the XML. My result that I want is the value in the tag WorkCodeUDF index[2], which is equal to 1. Thanks for a ny help!!! Lisa |
|
Back to top |
|
 |
kirani |
Posted: Wed Aug 20, 2003 11:08 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Lisa,
You could use SELECT statement to do this:
Code: |
SELECT R.WorkCodeUDF FROM InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[] as R where
R.(XML.Attribute)index = '2')
|
_________________ 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 |
|
 |
Craig B |
Posted: Wed Aug 20, 2003 11:23 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
Is there a slight mistake in the example? It says R.WorkCodeUDF but R will be pointing at the current WorkCodeUDF entry anyway. I think this should be :
Code: |
THE(
SELECT ITEM A
FROM InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[] AS A
WHERE A.(XML.attr)index = '2');
|
Where I have also used THE and ITEM to ensure one result is returned. _________________ Regards
Craig |
|
Back to top |
|
 |
kirani |
Posted: Wed Aug 20, 2003 11:35 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Good catch Craig!
I mistyped R.WorkCodeUDF, it should be R only. _________________ 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 |
|
 |
LH33 |
Posted: Wed Aug 20, 2003 12:14 pm Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Thanks!!
I put the following in the code: DECLARE TROUBLE int;
SET TROUBLE = THE(
SELECT ITEM A
FROM InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[] AS A
WHERE A.(XML.ATTRIBUTE)index = '2');
and I get the following error:
BIP2432E: (7, 10) : The correlation name 'XML' is not valid. Those in scope are: Environment, InputLocalEnvironment, OutputLocalEnvironment, InputRoot, InputBody, InputProperties, OutputRoot, InputExceptionList, OutputExceptionList, InputDestinationList, OutputDestinationList, TROUBLE, A.
Did I type something wrong?
Thanks, Lisa |
|
Back to top |
|
 |
kirani |
Posted: Wed Aug 20, 2003 12:44 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
I believe it's complaining for XML.ATTRIBUTE. I think it's case sensitive, so please try using XML.Attribute instead. _________________ 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 |
|
 |
LH33 |
Posted: Wed Aug 20, 2003 12:53 pm Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Kiran,
I modified the code as follows: NOTE: It wouldn't deploy unless I put the (A.XML.Attribute)
SET TROUBLE = THE(
SELECT ITEM A
FROM InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[] AS A
WHERE A.(A.XML.Attribute)index = '2');
SET OutputRoot.XML.CreateJob.DataArea.Job.testind2 = TROUBLE;
Here is my Trace node results off the Catch Terminal: Root
(
(0x1000000)Properties = (
(0x3000000)MessageSet = ''
(0x3000000)MessageType = ''
(0x3000000)MessageFormat = ''
(0x3000000)Encoding = 546
(0x3000000)CodedCharSetId = 437
(0x3000000)Transactional = TRUE
(0x3000000)Persistence = TRUE
(0x3000000)CreationTime = GMTTIMESTAMP '2003-08-20 20:44:22.950'
(0x3000000)ExpirationTime = -1
(0x3000000)Priority = 0
(0x3000000)ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x3000000)ReplyProtocol = 'MQ'
(0x3000000)Topic = NULL
)
(0x1000000)MQMD = (
(0x3000000)SourceQueue = 'DSPCH_OMS_DATA'
(0x3000000)Transactional = TRUE
(0x3000000)Encoding = 546
(0x3000000)CodedCharSetId = 437
(0x3000000)Format = 'MQSTR '
(0x3000000)Version = 2
(0x3000000)Report = 0
(0x3000000)MsgType = 8
(0x3000000)Expiry = -1
(0x3000000)Feedback = 0
(0x3000000)Priority = 0
(0x3000000)Persistence = 1
(0x3000000)MsgId = X'414d51204745544d513120202020202050453a3f12805209'
(0x3000000)CorrelId = X'000000000000000000000000000000000000000000000000'
(0x3000000)BackoutCount = 0
(0x3000000)ReplyToQ = ' '
(0x3000000)ReplyToQMgr = 'GETMQ1 '
(0x3000000)UserIdentifier = 'MTSRUN_MQ '
(0x3000000)AccountingToken = X'1601051500000008691451fa547e13c811bf7b421f000000000000000000000b'
(0x3000000)ApplIdentityData = ' '
(0x3000000)PutApplType = 11
(0x3000000)PutApplName = ':\WINNT\System32\dllhost.exe'
(0x3000000)PutDate = DATE '2003-08-20'
(0x3000000)PutTime = GMTTIME '20:44:22.950'
(0x3000000)ApplOriginData = ' '
(0x3000000)GroupId = X'000000000000000000000000000000000000000000000000'
(0x3000000)MsgSeqNumber = 1
(0x3000000)Offset = 0
(0x3000000)MsgFlags = 0
(0x3000000)OriginalLength = -1
)
(0x1000010)XML = (
(0x1000000)CreateJob = (
(0x3000000)environment = 'Test'
(0x3000000)revision = '1.0.0'
(0x1000000)ApplicationArea = (
(0x1000000)Sender = (
(0x1000000)Component = (
(0x2000000) = 'OMS'
)
(0x1000000)Confirmation = (
(0x2000000) = 'Always'
)
(0x1000000)AuthorizationId = (
(0x2000000) = 'OMS Interface'
)
)
(0x1000000)CreationDateTime = (
(0x2000000) = '2003-08-11T09:50:03'
)
(0x1000000)BODId = (
(0x2000000) = '{270F340A-6A8A-4572-A4EC-E7D7317F982C}'
)
)
(0x1000000)DataArea = (
(0x1000000)Create = (
(0x3000000)confirm = 'Always'
)
(0x1000000)Job = (
(0x1000000)ExternalNumbers = (
(0x1000000)ExternalNumber = (
(0x3000000)index = '1'
(0x2000000) = 'OMS:500001'
)
)
(0x1000000)ParentNumber =
(0x1000000)Origin = (
(0x2000000) = 'OMS'
)
(0x1000000)AgencyCode = (
(0x2000000) = 'EOM'
)
(0x1000000)TimeLine = (
(0x1000000)CreationDateTime = (
(0x2000000) = '2003-08-11T09:48:00'
)
(0x1000000)StartAfterDateTime = (
(0x2000000) = '2003-08-11T09:50:03'
)
)
(0x1000000)UDFS = (
(0x1000000)UDF = (
(0x3000000)index = '5'
(0x2000000) = '4804'
)
(0x1000000)UDF = (
(0x3000000)index = '6'
(0x2000000) = '30103200024'
)
(0x1000000)UDF = (
(0x3000000)index = '7'
)
(0x1000000)UDF = (
(0x3000000)index = '8'
(0x2000000) = '1'
)
(0x1000000)UDF = (
(0x3000000)index = '9'
(0x2000000) = 'OUT'
)
)
(0x1000000)Filters = (
(0x1000000)Filter = (
(0x3000000)index = '1'
)
(0x1000000)Filter = (
(0x3000000)index = '2'
(0x2000000) = 'Front Street'
)
)
(0x1000000)Location = (
(0x1000000)Address = (
(0x1000000)Streets = (
(0x1000000)Street = (
(0x3000000)index = '1'
(0x1000000)Name = (
(0x2000000) = 'R 2418 W FRANKLIN ST'
)
)
)
(0x1000000)CityCode = (
(0x2000000) = '-'
)
)
(0x1000000)Latitude = (
(0x2000000) = '1.4099e+006'
)
(0x1000000)Longitude = (
(0x2000000) = '592746'
)
(0x1000000)Customer = (
(0x1000000)Name = (
(0x2000000) = 'Not Applicable'
)
(0x1000000)Comment =
(0x1000000)Address = (
(0x1000000)FreeFormat =
)
)
(0x1000000)Phones = (
(0x1000000)Phone = (
(0x3000000)index = '1'
(0x1000000)Number =
)
)
)
(0x1000000)LevelCode5 = (
(0x2000000) = '3010320'
)
(0x1000000)WorkCodeUDFS = (
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '2'
(0x2000000) = '1'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '3'
(0x2000000) = 'PD'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '4'
(0x2000000) = 'Protective Device'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '5'
(0x2000000) = 'A'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '6'
(0x2000000) = 'A'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '7'
(0x2000000) = '0100'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '8'
(0x2000000) = '1'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '9'
(0x2000000) = '00000'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '10'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '56'
(0x2000000) = 'ACK'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '57'
(0x2000000) = '4804'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '58'
(0x2000000) = '30103200024'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '59'
(0x2000000) = '1'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '60'
(0x2000000) = '0'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '61'
(0x2000000) = '0'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '62'
(0x2000000) = '0'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '63'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '74'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '83'
(0x2000000) = 'R 2418 W FRANKLIN ST'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '84'
(0x2000000) = '1'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '85'
(0x2000000) = '3500'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '86'
(0x2000000) = '517860'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '87'
(0x2000000) = '90'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '88'
(0x2000000) = '62'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '64'
(0x2000000) = 'Not Applicable'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '65'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '66'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '67'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '68'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '69'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '70'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '71'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '72'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '73'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '11'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '12'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '13'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '14'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '15'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '16'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '17'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '18'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '19'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '20'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '21'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '22'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '23'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '24'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '25'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '26'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '27'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '28'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '29'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '30'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '31'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '32'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '33'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '34'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '35'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '36'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '37'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '38'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '39'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '40'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '41'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '42'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '43'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '44'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '45'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '46'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '47'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '48'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '49'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '50'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '51'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '52'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '53'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '54'
)
(0x1000000)WorkCodeUDF = (
(0x3000000)index = '55'
)
)
)
)
)
(0x6000002) = '
'
)
)
ExceptionList(
(0x1000000)RecoverableException = (
(0x3000000)File = 'F:\build\S210_P\src\DataFlowEngine\ImbComputeNode.cpp'
(0x3000000)Line = 453
(0x3000000)Function = 'ImbComputeNode::evaluate'
(0x3000000)Type = 'ComIbmComputeNode'
(0x3000000)Name = '88c1bc79-f500-0000-0080-83480914a757'
(0x3000000)Label = 'OMSTOMDS.TransformCreate'
(0x3000000)Text = 'Caught exception and rethrowing'
(0x3000000)Catalog = 'WMQIv210'
(0x3000000)Severity = 3
(0x3000000)Number = 2230
(0x1000000)RecoverableException = (
(0x3000000)File = 'F:\build\S210_P\src\DataFlowEngine\ImbRdl\ImbRdlFieldRef.cpp'
(0x3000000)Line = 311
(0x3000000)Function = 'SqlPathElement::evaluateType'
(0x3000000)Type = ''
(0x3000000)Name = ''
(0x3000000)Label = ''
(0x3000000)Text = 'type must be integer'
(0x3000000)Catalog = 'WMQIv210'
(0x3000000)Severity = 3
(0x3000000)Number = 2546
(0x1000000)Insert = (
(0x3000000)Type = 2
(0x3000000)Text = '7'
)
(0x1000000)Insert = (
(0x3000000)Type = 2
(0x3000000)Text = '10'
)
(0x1000000)Insert = (
(0x3000000)Type = 5
(0x3000000)Text = 'NULL'
)
(0x1000000)Insert = (
(0x3000000)Type = 5
(0x3000000)Text = 'UNKNOWN'
)
(0x1000000)Insert = (
(0x3000000)Type = 5
(0x3000000)Text = '(...)'
)
)
)
)
DestinationList
LocalEnvironment
I'm having trouble understanding what the exception list is trying to tell me. Any ideas?
Thanks, Lisa |
|
Back to top |
|
 |
kirani |
Posted: Wed Aug 20, 2003 1:22 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Lisa,
I tried this code on my machine and I got the correct results.
Code: |
SET Environment.Variables.Result = THE ( SELECT ITEM R FROM InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[] as R where
R.(XML.Attribute)index = '2');
|
Here is the trace output ..
Code: |
2003-08-20 14:26:37.421
(
(0x1000000)Variables = (
(0x3000000)Result = '1'
)
)
|
What version of WMQI and CSD level you are at? I tested this on WMQI 2.1 CSD4 on Win2K. _________________ 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 |
|
 |
LH33 |
Posted: Wed Aug 20, 2003 1:25 pm Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
kiran,
I'm on the same versions - let me try it again using the code you just posted.
Thanks!!! Lisa |
|
Back to top |
|
 |
LH33 |
Posted: Wed Aug 20, 2003 1:30 pm Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Kiran,
Yes - It Works!!! Thanks so much - that was a tough one for me!!
Have a good one, Lisa |
|
Back to top |
|
 |
|