Author |
Message
|
vijay707 |
Posted: Mon Aug 29, 2005 2:12 pm Post subject: error when assigning a value to reference in procedure |
|
|
Novice
Joined: 12 Feb 2004 Posts: 18
|
I am getting an error while executing a procedure.
CREATE LASTCHILD OF OutputRoot Domain('MRM');
DECLARE my_Header1 REFERENCE TO OutputRoot.MRM;
DECLARE soap REFERENCE TO InputRoot.XML
declare request boolean false;
call SOAPXML_TO_MRM_HEADER(soap,request,my_Header1) ;
Create Procedure SOAPXML_TO_MRM_HEADER(IN soap REFERENCE, IN request BOOLEAN, OUT BP_Header REFERENCE)
BEGIN
DECLARE soapenv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
DECLARE ref_hdr reference to soap.soapenv:Envelope.soapenv:Header ;
SET BP_Header.SERVICE_PORTION.SERVICE_PKG = ref_hdr.Addressing.packageName;
SET BP_Header.SERVICE_PORTION.SERVICE_NM = ref_hdr_To.Addressing.consumerType;
END;
I am getting the following error when I try to set a value to this field BP_Header.SERVICE_PORTION.SERVICE_PKG = ref_hdr.Addressing.packageName;
This is MQSI trace.
The dynamic field reference does not resolve to a modifiable quantity.
The dynamic field reference supplied must resolve to a modifyable quantity (a declared variable or a field in a modifyable message) as the usage implies that its value is to be changed.
Correct the logic of the SQL program and redeploy.
Last edited by vijay707 on Tue Aug 30, 2005 7:09 am; edited 2 times in total |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Aug 29, 2005 7:43 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
I suggest checking if the reference "ref_hdr" is pointing to the tree structure you want, using the Debug. |
|
Back to top |
|
 |
mgk |
Posted: Tue Aug 30, 2005 3:47 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
What is BP_Header ? Where does it point to? How and where do you declare it?. It is not in your code.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
vijay707 |
Posted: Tue Aug 30, 2005 6:01 am Post subject: |
|
|
Novice
Joined: 12 Feb 2004 Posts: 18
|
Sorry I made a mistake .BP_Header is the out parameter which is a reference which I pass to the procedure. |
|
Back to top |
|
 |
JT |
Posted: Tue Aug 30, 2005 11:35 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
Create Procedure SOAPXML_TO_MRM_HEADER(IN soap REFERENCE, IN request BOOLEAN, OUT BP_Header REFERENCE) |
Try:
Quote: |
Create Procedure SOAPXML_TO_MRM_HEADER(IN soap REFERENCE, IN request BOOLEAN, INOUT BP_Header REFERENCE) |
|
|
Back to top |
|
 |
mgk |
Posted: Tue Aug 30, 2005 12:02 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Or you could try:
Quote: |
Create Procedure SOAPXML_TO_MRM_HEADER(IN soap REFERENCE, IN request BOOLEAN, IN BP_Header REFERENCE) |
It the fact that it is OUT that is the problem in this case.
For variables of the REFERENCE datatype passed to a procedure that takes a REFERENCE parameter:
A direction of IN means that the reference itself cannot be moved to point somwhere else whilst inside the procedure, but the thing that it is a reference to can be modified (if it points to a valid location), so you can use it in a SET statement for example, but not a MOVE statement.
A direction of OUT means that the reference is NULL (it is made to be a reference that points nowhere) when the procedure is entered, but it can be moved inside the procedure to point somewhere. So you cannot change the thing it points to until you first move it to point somewhere valid. Wherever you move it to, the reference variable you passed in is made to point to that location when the procedure returns. (This includes nowhere (NULL) if you do not MOVE an OUT reference inside the procedure).
A direction of INOUT is a combination of IN and OUT which means that it points to where it was pointing before the procedure was called and (assuming it pointed to a valid location) that location can be changed inside the procedure. The reference can also be moved inside the procedure, and when the procedure returns the variable you passed into the procedure as a reference is made to point to the new location when the procedure returns, wherever that location is (valid or not).
Hope this helps to clarify things.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
vijay707 |
Posted: Tue Aug 30, 2005 1:22 pm Post subject: |
|
|
Novice
Joined: 12 Feb 2004 Posts: 18
|
Thanks JT and MGk for your help now I could create the MRM message structure successfully by using INOUT reference parameter instead of OUT.
Vijay |
|
Back to top |
|
 |
mgk |
Posted: Tue Aug 30, 2005 1:36 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
One thing I did not say above, was that IN references will be slightly faster than INOUT references, as extra steps are involved in copying the setting up and copying back the reference when using INOUT references. _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|