Author |
Message
|
Diwakar |
Posted: Wed Oct 28, 2009 1:05 pm Post subject: SUBSTRING on MRM ( COBOL copybook) failing |
|
|
Apprentice
Joined: 06 Apr 2005 Posts: 33
|
Hi,
I haven't coded anything in MB in a long time.
Please excuse me if the question sounds silly.
Can we do a SUBSTRING on MRM message that represents a copybook coming in from mainframe ?
Is this possible:
SET Environment.Variables.tax = SUBSTRING(InputRoot.MRM.FILLER4 FROM 1 FOR 10);
This is in a reply msgflow which gets a COBOL message from mainframe.
I know SUBSTRING works only on CHAR, BIT, and BLOB but I am not sure whether it applies to MRM.
Can someone please clarify ?
Thanks _________________ Diwakar. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 28, 2009 2:57 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Is this possible:
SET Environment.Variables.tax = SUBSTRING(InputRoot.MRM.FILLER4 FROM 1 FOR 10); |
Definitely. A CHARACTER field produced by the MRM parser is no different to a CHARACTER field which you created yourself in your ESQL. ESQL doesn't care how the field was created ( and neither does Java/PHP/Mapping node).
The various parsers do build message trees with different structures, and they set the TYPE ( the parser-specific field type ) differently. That can affect how you query the message tree to get at the fields. Apart from that, the processing of the message tree is parser-independent. |
|
Back to top |
|
 |
Diwakar |
Posted: Wed Oct 28, 2009 5:06 pm Post subject: |
|
|
Apprentice
Joined: 06 Apr 2005 Posts: 33
|
Hi Kimbert,
Thanks for the detail.
Here is my scenario.
We are doing a simple end-to-end test with MB v6.1 / MQ v6 on Solaris and MQ v6 on mainframe.
I have a simple request msgflow/msgset that is working fine:
MQInput (XMLNSC) --> Compute (XMLNSC to COBOL) --> MQOutput (MRM)
The ESQL in REQUEST flow's compute node:
-------------------------------------------------------------------------------------
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
Set OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.MessageSet = 'I5G5ESS002001';
SET OutputRoot.Properties.MessageType = 'msg_DOCUMENTREQUEST';
SET OutputRoot.Properties.MessageFormat = 'Binary1';
Set OutputRoot.MQMD = InputRoot.MQMD;
Set OutputRoot.MRM.FILLER1 = 'QUERY ';
Set OutputRoot.MRM.FILLER2 = 'APPCP001';
Set OutputRoot.MRM.FILLER3 = ' ';
Set OutputRoot.MRM.FILLER4 = InputRoot.XMLNSC.DocumentVO.document.docId ||
InputRoot.XMLNSC.DocumentVO.document.reason ||
InputRoot.XMLNSC.DocumentVO.document.remedy ||
InputRoot.XMLNSC.DocumentVO.document.dateMonth ||
InputRoot.XMLNSC.DocumentVO.document.dateYear;
RETURN TRUE;
END;
-------------------------------------------------------------------------------------
The reply msgflow/msgset is also simple but it is FAILING as I mentioned above:
MQInput(MRM) --> Compute (COBOL to XMLNSC) --> MQOutput(XMLNSC)
The MQInput node has the parser ( MRM), msgset/type/format correctly set.
The SAME cobol copybook is used for both request/reply msgsets for the test.
The ESQL in REPLY flow's compute node that is failing:
-------------------------------------------------------------------------------------
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
Set OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.Properties.MessageSet = '';
SET OutputRoot.Properties.MessageType = '';
SET OutputRoot.Properties.MessageFormat = ' MQSTR';
Set OutputRoot.MQMD = InputRoot.MQMD;
Set OutputRoot.XMLNSC.DocumentVO.document.docId = SUBSTRING(InputRoot.MRM.FILLER4 FROM 1 FOR 10);
Set OutputRoot.XMLNSC.DocumentVO.document.reason = SUBSTRING(InputRoot.MRM.FILLER4 FROM 11 FOR 10);
Set OutputRoot.XMLNSC.DocumentVO.document.remedy = SUBSTRING(InputRoot.MRM.FILLER4 FROM 21 FOR 10);
Set OutputRoot.XMLNSC.DocumentVO.document.dateMonth = SUBSTRING(InputRoot.MRM.FILLER4 FROM 31 FOR 10);
Set OutputRoot.XMLNSC.DocumentVO.document.dateYear = SUBSTRING(InputRoot.MRM.FILLER4 FROM 41 FOR 10);
RETURN TRUE;
END;
-------------------------------------------------------------------------------------
The input/output xml message used is (each xml field has exactly 10 chars):
<DocumentVO>
<document>
<docId>0123456789</docId>
<reason>0123456789</reason>
<remedy>0123456789</remedy>
<dateMonth>0123456789</dateMonth>
<dateYear>0123456789</dateYear>
</document>
</DocumentVO>
The input/output copybook used in the msgset (MRM) is ( all 5 xml tag values get concatenated and go into FILLER4 in the request flow, and the reply flow simply UNDOES what the request flow does):
01 DOCUMENTREPLY.
05 FILLER1 PIC X(0 VALUE ‘QUERY ‘.
05 FILLER2 PIC X(0 VALUE ‘APPCP001‘.
05 FILLER3 PIC X(0 VALUE ‘SUCCESS ‘.
05 FILLER4 PIC X(100) VALUE SPACES.
An exception is thrown in the REPLY flow ESQL at the first SUBSTRING statement.
..... please replace the smiley symbols above with the number 8 in the PIC clauses......
-------------------------------------------------------------
The EXCEPTIONLIST generated in the REPLY flow is:
-------------------------------------------------------------
Code: |
<EXCEPTIONLIST><RecoverableException><File>/build/S610_P/src/DataFlowEngine/ImbComputeNode.cpp</File><Line>464</Line><Function>ImbComputeNode::evaluate</Function>
<Type>ComIbmComputeNode</Type><Name>CMS_TestFlowReply1#FCMComposite_1_3</Name><Label>CMS_TestFlowReply1.COBOLtoXML</Label><Catalog>BIPv610</Catalog><Severity>3</Severity><Number>2230</Number>
<Text>Caught exception and rethrowing</Text>
<RecoverableException><File>/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlStatementGroup.cpp</File><Line>602</Line><Function>SqlStatementGroup::execute</Function>
<Type>ComIbmComputeNode</Type><Name>CMS_TestFlowReply1#FCMComposite_1_3</Name><Label>CMS_TestFlowReply1.COBOLtoXML</Label>
<Catalog>BIPv610</Catalog><Severity>3</Severity><Number>2488</Number><Text>Error detected, rethrowing</Text>
<Insert><Type>5</Type><Text>.CMS_TestFlowReply1_COBOLtoXML.Main</Text></Insert><Insert><Type>5</Type><Text>17.3</Text></Insert><Insert><Type>5</Type>
<Text>SET OutputRoot.XMLNSC.DocumentVO.document.docId = SUBSTRING(InputRoot.MRM.FILLER4 FROM 1 FOR 10);</Text>
</Insert>
<RecoverableException><File>/build/S610_P/src/DataFlowEngine/ImbRdl/ImbRdlFieldRef.cpp</File><Line>2615</Line><Function>SqlFieldReference::evaluate</Function><Type>ComIbmComputeNode</Type>
<Name>CMS_TestFlowReply1#FCMComposite_1_3</Name><Label>CMS_TestFlowReply1.COBOLtoXML</Label><Catalog>BIPv610</Catalog><Severity>3</Severity><Number>2498</Number>
<Text>Navigation error</Text><Insert><Type>5</Type><Text>.CMS_TestFlowReply1_COBOLtoXML.Main</Text></Insert><Insert><Type>5</Type><Text>17.63</Text>
</Insert><Insert><Type>2</Type><Text>3</Text></Insert><ParserException><File>/build/S610_P/src/MTI/MTIforBroker/MtiImbParser2/MtiImbParser.cpp</File><Line>730</Line>
<Function>MtiImbParser::parseRightSibling</Function><Type>ComIbmMQInputNode</Type><Name>CMS_TestFlowReply1#FCMComposite_1_1</Name><Label>CMS_TestFlowReply1.APP.GEN.COBOL.DQB.REPLY</Label>
<Catalog>BIPv610</Catalog><Severity>3</Severity><Number>5285</Number>
<Text>ImbRecoverableException caught from worker->parseNext.</Text>
<Insert><Type>5</Type><Text>CMS_MsgSet1_Reply</Text>
</Insert><Insert><Type>2</Type><Text>1</Text></Insert><Insert><Type>5</Type><Text>Binary1</Text></Insert><Insert><Type>5</Type><Text>/msg_DOCUMENTREPLY/FILLER4</Text></Insert><ParserException>
<File>/build/S610_P/src/cpi/pwf/cwf/cwfworker.cpp</File><Line>315</Line><Function>CWFWorker::parseNext</Function><Type></Type><Name></Name><Label></Label><Catalog>BIPv610</Catalog><Severity>3</Severity>
<Number>5171</Number><Text>CWF Parsing error</Text><Insert><Type>2</Type><Text>0</Text></Insert>
<Insert><Type>5</Type><Text>CWFWorker::parseNext</Text></Insert><Insert><Type>5</Type><Text>msg_DOCUMENTREPLY</Text></Insert><Insert><Type>5</Type><Text>msg_DOCUMENTREPLY</Text></Insert>
<Insert><Type>5</Type><Text></Text></Insert><Insert><Type>2</Type><Text>124</Text></Insert><ParserException><File>/build/S610_P/src/MTI/MTIforBroker/MtiImbParser2/MtiImbFIHandler.cpp</File><Line>1009</Line>
<Function>MtiImbFIHandler::endMessageContent</Function><Type></Type><Name></Name><Label></Label><Catalog>BIPv610</Catalog><Severity>3</Severity><Number>5288</Number>
<Text>MTI. Not all the buffer was used when reading message</Text>
<Insert><Type>2</Type><Text>124</Text>
</Insert><Insert><Type>2</Type><Text>273</Text>
</Insert></ParserException></ParserException></ParserException>
</RecoverableException></RecoverableException>
</RecoverableException></EXCEPTIONLIST> |
--------------------------------------------------------------------------
The mainframe end application simply GETs(with CONVERT) the cobol request message and then PUTs a reply cobol message back. We verified that it is working fine and it was successfully putting a reply message on MB.
I read from MB v6.1 documentation that MRM parser converts the ccsid/encoding automatically when MB reads the message from the Input queue ( for the REPLY flow in my case). So, I didn't convert them anywhere.
And I didn't use msgsets for the XMLNSC parser.
Can somebody please explain why/how my REPLY flow ESQL is failing ? And please tell me how to fix the issue ?
Thanks in advance for your time.
Regds, _________________ Diwakar. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Oct 28, 2009 5:52 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
edited for readability.
Looks like you have a problem. I would suggest you do not use the MQ feature to convert on the input node even if the message format is MQSTR.
It says in the exception tree that you did not have the right format for the input node: the input message contained more than what you defined...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Diwakar |
Posted: Wed Oct 28, 2009 6:09 pm Post subject: |
|
|
Apprentice
Joined: 06 Apr 2005 Posts: 33
|
fib_saper,
I am NOT setting the convert flag option on the REPLY flow's MQInput node. MB documentation says I shouldn't use it ( in my partcular case).
I am NOT sure if the mainframe application is setting the Format field to MQSTR.
The FILLER4 element has all the 5 xml tags concatenated. The xml I posted has sample values only. The actual tags in the xml used are the same, but the values are different from the ones I posted above.
Any ideas on what I should do further to solve the problem ?
Thanks. _________________ Diwakar. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Oct 28, 2009 6:27 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Yes.
Get the right copy book.
Or get the MF app to set the right buffer size...
The broker's error tells you that the copy book you are using is shorter than the data you are receiving.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|