Author |
Message
|
EvolutionQuest |
Posted: Wed Mar 10, 2004 2:09 pm Post subject: CREATE FIELD .... PARSE .... |
|
|
 Voyager
Joined: 18 Sep 2001 Posts: 88 Location: Billings, MT
|
Does anyone have a good example of using the CREATE FIELD which uses the PARSE option?
I am trying to call a stored procedure (SP) that requires a COBOL copybook type structure as its input/output parm.
I was originally thinking about wrapping the SP with another one which took the fields as individual input and output parms based on field requirements.
What would be the best way to tackle this problem where I need to construct a single field with the proper input fields, and then extract those fields for the output. I sense it is easier to parse the return results easier than constructing the input, but any insight is greatly appreciated.
Thanks.
Chris |
|
Back to top |
|
 |
EddieA |
Posted: Wed Mar 10, 2004 2:30 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Chris,
PARSE isn't an option on CREATE FIELD. It's only valid on FIRSTCHILD, LASTCHILD, PREVIOUSSIBLING, and NEXTSIBLING.
What, exactly, are you trying to do. Are you trying to create a single field that actually contains a structure. In which case ASBITSTREAM (or BITSTREAM) will do that. If the data comes back as a BLOB, then you could use CREATE ... PARSE to re-build an MRM or XML tree from it.
Or, have I misunderstood.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
EKhalil |
Posted: Thu Mar 11, 2004 5:59 am Post subject: |
|
|
Voyager
Joined: 29 Apr 2003 Posts: 99 Location: Boston, MA
|
CREATE LASTCHILD OF Environment.Variables.MRM_Record DOMAIN 'MRM' PARSE (bitstream(InputBody), 785, 500, 'DP0U9J0086001', 'VehicleResponseMessage', 'CWF');
Hope this helps
Eva |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 11, 2004 6:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
[soapbox]You should not use BITSTREAM if you are running 2.1 CSD03 or greater. You should use ASBITSTREAM instead.[/soapbox] _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
EvolutionQuest |
Posted: Thu Mar 11, 2004 7:13 am Post subject: |
|
|
 Voyager
Joined: 18 Sep 2001 Posts: 88 Location: Billings, MT
|
Well, just typed my response and something blew it away. Anyway I have no idea at times what I am doing, then again I have been wondering that for years
What I am trying to do is construct the following into one input variable for the SP:
10 FIELD1 PIC X(15).
10 FIELD2 PIC 9(2).
10 FIELD3.
15 FIELD3-NO-IDEA.
17 FIELD3-NO-REAL-IDEA PIC X(12).
17 FIELD3-NO-REAL-1.
20 FIELD3-REAL-1 PIC X(1).
20 FILLER PIC X(15).
and then that same structure will come back to me in one output parm which I'll need to parse. The this part is simple, but the first portion doesn't seem to make sense. In ESQL I don't see how I can concat() FIELD1 for the full size of character 15 with FIELD2 which is a integer.
Hope this makes more sense. |
|
Back to top |
|
 |
EddieA |
Posted: Thu Mar 11, 2004 7:32 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Chris,
I think you would have to build an MRM that describes this. Built it, and then ASBITSTREAM it to get the BLOBed version.
On return, you can build a tree from the BLOB, by PARSING it.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
JLRowe |
Posted: Thu Mar 11, 2004 9:26 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
Just to clarify how BITSTREAM and ASBITSTREAM differ.
BITSTREAM returns the bitstream of the current message, typically the orignal serialised message recieved by the MQInput node. Any changes made to the message in the message tree are not reflected in the ouput of BITSTREAM.
ASBITSTREAM takes the message tree, serialises it via the owning parser (as an MQOutput node would do), and does reflect changes made to the message tree. |
|
Back to top |
|
 |
neo_revolution |
Posted: Thu Mar 11, 2004 9:59 am Post subject: |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
I tried to access something like this
CREATE LASTCHILD OF Environment.Variables.Temp DOMAIN 'XML' PARSE (ASBITSTREAM(InputRoot.XML.Header), 0, 437, '', '', 'XML');
It created Environment tree whicl looke like this
<Environment>
<Variables>
<Temp>
<XML>
............
I wonder why XML tag is being created?? |
|
Back to top |
|
 |
EddieA |
Posted: Thu Mar 11, 2004 10:34 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Because that's the way it works.
If you PARSEd using the MRM domain, it would put MRM as the leading tag.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
EKhalil |
Posted: Thu Mar 11, 2004 11:01 am Post subject: |
|
|
Voyager
Joined: 29 Apr 2003 Posts: 99 Location: Boston, MA
|
I think that will be the domain 'XML' . When the domain is 'MRM' the first element is 'MRM'
"...0x1000021)MRM = (
(0x300000B)ERROR_INFO_CNT = 2
(0x300000B)MESSAGE_INFO_CNT = 1..." |
|
Back to top |
|
 |
EvolutionQuest |
Posted: Sun Mar 14, 2004 2:01 pm Post subject: |
|
|
 Voyager
Joined: 18 Sep 2001 Posts: 88 Location: Billings, MT
|
O.K. I don't follow on creating an area that I can put in place as an MRM, update the specific fields of that MRM, and then send it as a bitstream. It just isn't clicking for me.
Code: |
CREATE LASTCHILD OF Environment.Variables.MRM_Record DOMAIN 'MRM' PARSE (bitstream(InputBody), 785, 500, 'DP0U9J0086001', 'VehicleResponseMessage', 'CWF');
|
I don't understand how I can create a MRM field from a specific message set that needs to be sent to a SP as a bitstream. What is the syntax needed to do this? The only place I see that I can use a message set name is in the parse option for previoussibling/nextsibling.
I need a little help here.
Just to re-iterate what I am trying to accomplish. I need to construct a fixlength blob that will be sent to a stored procedure. I first need to set the values in the blob before sending it off to the SP. Then I will get back a BLOB which I can parse using the PARSE feature of CREATE. The road block for me is the first portion on creating a reference to a specific message set that has nothing to do with the InputBody/OutputBody. It is a special case where I need to create a MRM type field, update specific fields, then convert it to a bitstream and call the SP.
[/code] |
|
Back to top |
|
 |
EddieA |
Posted: Mon Mar 15, 2004 9:59 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Chris, you're going to have to build a "dummy" Output tree, using an MRM that describes the BLOB you require, and then ASBITSTREAM it. That should force WMQI to serialise it.
Then you can set the tree to NULL, and build your 'real' Output.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
EvolutionQuest |
Posted: Wed Mar 17, 2004 5:40 am Post subject: |
|
|
 Voyager
Joined: 18 Sep 2001 Posts: 88 Location: Billings, MT
|
I should of thought about this before. The answer is to declare a variable of a type, i.e. BLOB, CHAR, and so forth. Then use the OVERLAY function to lay in the values at their respective location. On the return parm I can either use a SUBSTRING() or just use CREATE ... PARSE and identify the message set and so forth.
All I can say is Duh! |
|
Back to top |
|
 |
|