| Author | 
		  Message
		 | 
		
		  | Bharat_123 | 
		  
		    
			  
				 Posted: Fri Jan 23, 2009 12:04 pm    Post subject: parsing CDH message to string | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 15 Sep 2008 Posts: 58
  
  | 
		  
		    
			  
				hello all
 
 
In Input node i am getting CDG message(flat file/ text file). I need to transform that data into XML.
 
 
mqInput node -- > comp Node---> mqoutput node
 
 
So far i tried to use MRM parser input node properties and formar Binary1.
 
 
In folliwng compute node...
 
 
SET OutputRoot.Properties.MessageSet = 'A14M4UK002001'; 
 
--SET OutputRoot.Properties.MessageType = typeName; 
 
SET OutputRoot.Properties.MessageFormat = 'XML1';
 
		
 
SET IbRequest = InputRoot.BLOB;
 
SET IbReq = CAST(IbRequest AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId);
 
SET uName = SUBSTRING(InputRoot.BLOB.BLOB FROM 205 FOR 228);
 
SET nCode = SUBSTRING(InputRoot.BLOB.BLOB FROM 229 FOR 238);
 
SEt cData = SUBSTRING(InputRoot.BLOB.BLOB FROM 319 FOR 344);
 
 
then here i started creating XML msg
 
 
CREATE FIELD OutputRoot.XMLNSC.IProcess TYPE Name;
 
		CREATE LASTCHILD OF OutputRoot.XMLNSC.Inter_Process.Ptags.Uname VALUE CAST(uName AS CHARACTER);
 
CREATE LASTCHILD OF OutputRoot.XMLNSC.IProcess.Ptags.NCode VALUE CAST(nCode AS CHARACTER);
 
CREATE LASTCHILD OF OutputRoot.XMLNSC.IProcess.Ptags.PUserId VALUE 'MED';
 
 
 
any ideas please
 
 
Input message looks like
 
 
R00101ACDH       DHCP010 POSCICCDH.PEND.IN                                    20081215112442SMHS                                                                                                        DQ01MHS                     HMRK      00000000         0150020081215112442012008102007TEST PROVIDER  01999999999      20081215112442001         0111 00                                                  S2001010129991231    1.2.5_TD00000000000000000000000000000000000000112533221           020553512221231JOHN                                                        001 195012100                                                                                                                                                                                                       020553512221231         01                              0000000000000 000000000000000000000000000000000 000000000000000000000000000000000 000000000000000000000000000000000 000000000000000000000000000000000 000000000000000000000000000000000 0000000000000000000001                          00 0000000000 0000000000000000000000 0000000000 0000000000000000000000 0000000000 0000000000000000000000 0000000000 0000000000000000000000 0000000000 0000000000000000000000 0000000000 00000000000000000000Y00000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000 000000000000                                                      0000000000000                             00 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Fri Jan 23, 2009 12:45 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				Hi,
 
 
I'm a little confused about what you are trying to do, so please excuse the list of questions:
 
 
- If you are using the MRM parser, then why does your ESQL reference InputRoot.BLOB?
 
- Why did you choose CWF instead of TDS? Does your data contain COBOL physical types ( packed decimal etc)?
 
- If you are using XMLNSC for your output side ( and you should ) then you do not need to set OutputRoot.MessageType/MessageFormat. 
 
- If you are using XMLNSC you probably don't need to set OutputRoot.MessageSet, unless your output node has the Validate property set to 'Content and Value' | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Bharat_123 | 
		  
		    
			  
				 Posted: Fri Jan 23, 2009 1:32 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 15 Sep 2008 Posts: 58
  
  | 
		  
		    
			  
				Thanx for ur reply
 
 
Based on the input message i tried different options
 
 
I took that whole CDH message as string and try to assign that to a variable
 
 
SET ibReq = InputMessage
 
 
by using SUBSTRING function i tried to get the required fields for my o/p XML message.
 
 
But as soon as that message enters into MQ INput node ..when i do debug its says XMLParser failure occured before its going to bext node..
 
 
I thought thats obivious because the message which i am receing is not a XML.
 
 
Then  i tried to use MRM parser and defined message set name in properties and format as Binary1 ...In input node properties.
 
 
In ESQl
 
 
 
 
--CALL CopyMessageHeaders();
 
CALL CopyEntireMessage();
 
 
SET OutputRoot.MRM = NULL;
 
 
becuase o/p is XML setting MRM = NULL
 
 
DECLARE IbRequest CHARACTER NULL;
 
DECLARE IbReq CHARACTER NULL;
 
DECLARE uName CHARACTER NULL;
 
DECLARE nCode CHARACTER NULL;
 
DECLARE cData CHARACTER NULL;
 
 
 
SET OutputRoot.Properties.MessageSet = 'A14M4UK002001'; 
 
--SET OutputRoot.Properties.MessageType = typeName; 
 
SET OutputRoot.Properties.MessageFormat = 'XML1';
 
 
SET IbRequest = InputRoot.MRM;
 
SET IbReq = CAST(IbRequest AS CHARACTER);
 
 
tried to convert the i/p msg as string and use substring function. didnt work...checked online help found diff solution to do so i used below method to extrat the substring from main string.
 
 
SET uName = SUBSTRING(InputRoot.BLOB.BLOB FROM 205 FOR 228);
 
SET nCode = SUBSTRING(InputRoot.BLOB.BLOB FROM 229 FOR 238);
 
SEt cData = SUBSTRING(InputRoot.BLOB.BLOB FROM 319 FOR 344);
 
 
 
PLease let me know is there diff way of doing or where i am going wrong
 
 
 
Thanks a lot | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Fri Jan 23, 2009 3:19 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				I believe the point Kimbert was trying to make is that your INPUT message should be parsed using MRM and that as such you would have to navigate the tree and not parse using substrings....   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Fri Jan 23, 2009 3:41 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| by using SUBSTRING function i tried to get the required fields for my o/p XML message.  | 
   
 
Message broker has a parser for almost any kind of input, and you should never need to write a parser in ESQL. The MRM solution is the correct one. And you should probably be using the TDS physical format unless you have a COBOL copybook to describe your input message.
 
   
	| Quote: | 
   
  
	| But as soon as that message enters into MQ INput node ..when i do debug its says XMLParser failure occured before its going to next node..  | 
   
 
This is a completely separate issue - you constructed your output message tree wrongly.
 
 
You seem to be quite confused about how to design a message flow. I suggest that you go to the Samples Gallery and install/try out some of the samples. Message Broker is a complex product, and you need to learn the basics before you can implement a solution. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Bharat_123 | 
		  
		    
			  
				 Posted: Fri Jan 23, 2009 4:04 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 15 Sep 2008 Posts: 58
  
  | 
		  
		    
			  
				Thanks for your imputs
 
 
I am pretty much close to resolve the problem. Instead MRM parser i used BLOB. It resolved me most of the problem i can say 50 %.
 
 
when i try to get the offset values from ESQL
 
 
i am getting the values in hexadecimal format i believe after doing CAST. Is there other way to cast BLOB values?
 
 
	<Uname>30314d4853202020202020202020202020202020202020202020484d524b202020202020303030303030303020202020202020202030313530303230303831323135313132343432303132303038313032303037544553542050524f5649444552202030313939393939393939392020202020203230303831323135313132343432303031202020202020202020303131312030302020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020533230303130313031323939393132333120202020312e322e355f5444</Uname>
 
		<NCode>2020484d524b202020202020303030303030303020202020202020202030313530303230303831323135313132343432303132303038313032303037544553542050524f5649444552202030313939393939393939392020202020203230303831323135313132343432303031202020202020202020303131312030302020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020533230303130313031323939393132333120202020312e322e355f544430303030303030303030303030303030303030303030303030303030303030303030</NCode>
 
		<PMUserId>SMA</PUserId>
 
		<TVer>SMACDH</TVersion>
 
		<TType>CLM</TType>
 
		<CSData>20203230303831323135313132343432303031202020202020202020303131312030302020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020533230303130313031323939393132333120202020312e322e355f5444303030303030303030303030303030303030303030303030303030303030303030303030303031313235333332323120202020202020202020203032303535333531323232313233314a4f484e202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202030303120313935303132313030202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020</CSData>
 
 
 
 
Please help me to solve the above problem
 
 
Thank u | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Bharat_123 | 
		  
		    
			  
				 Posted: Fri Jan 23, 2009 4:19 pm    Post subject: In continuation to above | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 15 Sep 2008 Posts: 58
  
  | 
		  
		    
			  
				  
 
 
I use the following code to extract the values
 
 
SET uName = SUBSTRING(InputRoot.BLOB.BLOB FROM 205 FOR 228);
 
SET nCode = SUBSTRING(InputRoot.BLOB.BLOB FROM 229 FOR 238);
 
SEt cData = SUBSTRING(InputRoot.BLOB.BLOB FROM 319 FOR 344);
 
 
and here i am casting the values into character
 
 
CREATE LASTCHILD OF OutputRoot.XMLNSC.IProcess.PMtags.Uname VALUE CAST(uName AS CHARACTER);
 
CREATE LASTCHILD OF OutputRoot.XMLNSC.IProcess.PMtags.NCode VALUE CAST(nCode AS CHARACTER);
 
 
 
Please correct me if i am doing wrong. Even after using cast function i dont see change in the result.
 
 
Thank You | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Fri Jan 23, 2009 4:33 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| I am pretty much close to resolve the problem | 
   
 
Sorry, but you are not even close. You should use the MRM parser. If you don't know how to do that, try out some samples. 
 
Using BLOB/substring will result in a message flow which is slow and hard to maintain. Please learn how to use the product as the designers intended. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Bharat_123 | 
		  
		    
			  
				 Posted: Sun Jan 25, 2009 11:51 am    Post subject: Thanx for your input | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 15 Sep 2008 Posts: 58
  
  | 
		  
		    
			  
				I have a Question
 
 
1. I donot have a copy book  if i want to use TDS and MRM parser.
 
 
2. I read on this forum, if i use we need to sent message type also. As i dont have copybook to generate and mxsd and to assign message type.
 
 
 
3. so i decided to use BLOB parser. As i know the offset values, i thought this will help me get the offset values. Iffact as i said in my last post i got the values but they are in hexadecimal.
 
 
please help me in convert hexadecimal to character if i am doing correct.
 
 
Thank you | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Sun Jan 25, 2009 12:38 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				Consider this:
 
- A Message Set tells message broker how to parse a message
 
- A Message Flow tells message broker how to process the parsed message
 
If you are using message broker correctly, your message flow will not contain any information about the physical layout of the message. It will only deal with the logical structure of the message.
 
 
   
	| Quote: | 
   
  
	|  do not have a copy book if i want to use TDS and MRM parser.  | 
   
 
 
Correct. You cannot populate the TDS physical format using the COBOL importer, or any other importer. You will have to 
 
a) create a message set
 
b) create a TDS physical format
 
c) create a  message definition file
 
d) create a message definition ( 'message type' ).
 
e) create elements to represent the logical structure of the message
 
f) set the length of each element 
 
If you have an XML schema, you can import that instead of performing steps c), d) and e).
 
 
   
	| Quote: | 
   
  
	| if i use we need to sent message type also | 
   
 
Correct. The message type is the name of the root element in the message definition. You will also need to supply the message set( name of your message set ) and message format ( the name of your TDS physical format ). 
 
   
	| Quote: | 
   
  
	| so i decided to use BLOB parser | 
   
 
I hope you decide to use MRM parser  after reading this. You cannot design a message flow if you do not understand how to parse a message using a message set. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Bharat_123 | 
		  
		    
			  
				 Posted: Mon Jan 26, 2009 10:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 15 Sep 2008 Posts: 58
  
  | 
		  
		    
			  
				Hello again
 
 
in another scenario i try to use cobol copy book and changed the extension to '.cpy' and tried to generate mxsd and geting followng error.
 
 
 
1. Syntax errors were found in the source. Check the 'Problems' view for the list of errors.
 
2. PPHSMDCO_Outbound_MEDCO_format.cpy is expected to have just 01 level data structures or 77 level elementary data item definition(s), based on its file extension.You can change the file extension support by going into the "More COBOL options" tab of the COBOL importer preferences page (Window -> Preferences -> Importer -> COBOL).
 
Line No : 17  IGYDS1176-E The first level-number was not 01 for item "MEDCO-HEADER-REC".  A level-number of 01 was assumed.
 
Line No : 33  IGYDS1066-S "REDEFINES" object "MEDCO-HEADER-REC" was not the immediately preceding level-5 data item.  The "REDEFINES" clause was discarded.
 
Line No : 139  IGYDS1066-S "REDEFINES" object "MEDCO-HEADER-REC" was not the immediately preceding level-5 data item.  The "REDEFINES" clause was discarded.
 
 Please correct the error and try importing the file again.
 
 
 
The actual copy book looks like
 
 
     *01  HEDCO-HISTORY-RECORD.                                        00080000
 
      *                                                         *
 
         05  HEDCO-HEADER-REC.                                          00390000
 
           10  HEDHR-PROTOCOL-SEG             PIC  X(200).              00390000
 
           10  HEDHR-RECORD-TYPE              PIC  X(02).               00400000
 
           10  HEDHR-COMPANY-NAME             PIC  X(20).               00410000
 
           10  HEDHR-DATA-TYPE                PIC  X(03).               00420000
 
           10  HEDHR-FILE-STATUS              PIC  X(01).               00430000
 
           10  HEDHR-FILE-TYPE                PIC  X(01).               00440000
 
           10  HEDHR-FILE-DATE                PIC  X(0 .               00450000
 
           10  HEDHR-FILE-TIME                PIC  X(06).               00460000
 
           10  HEDHR-FILE-SEQNO               PIC  9(0 .               00470001
 
           10  FILLER                         PIC  X(54).               01560000
 
           10  HEDHR-CLM-REF-ID               PIC  X(15).               01560000
 
           10  HEDHR-SIGNATURE                PIC  X(26).               01560000
 
           10  FILLER                         PIC  X(1156).             01560000
 
      *                                                         *       00490001
 
         05  HEDCO-DETAIL-REC REDEFINES                                 00520000
 
             MEDCO-HEADER-REC.                                          00530000
 
           10  MEDDR-PROTOCOL-SEG             PIC  X(200).              00082000
 
 
 
THIS IS   aprt of the copy book
 
 
please suggest me what do i have to do to avoid those errors
 
 
Thank You | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Mon Jan 26, 2009 12:15 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| Bharat_123 wrote: | 
   
  
	| THIS IS   aprt of the copy book | 
   
 
 
 
And without seeing the rest of it, it does make it harder to identify issues.
 
 
   
	| Bharat_123 wrote: | 
   
  
	| please suggest me what do i have to do to avoid those errors | 
   
 
 
 
Think about what the error messages are trying to tell you. Also consider what the resulting message set from that copybook would look like, and why the importer is querying certain elements.
 
 
You might find the documentation on the COBOL importer illuminating. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Bharat_123 | 
		  
		    
			  
				 Posted: Tue Jan 27, 2009 11:08 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 15 Sep 2008 Posts: 58
  
  | 
		  
		    
			  
				Hello
 
 
I am getting following error message when try to fetch the 
 
 
        01 OB-PBM-RECORD.
 
           05 OB-KEY.
 
              10 OB-KEY-PLAN-CD       PIC X(03).
 
                 88 PN-HM                VALUE 'MUM'.
 
                 88 PN-MST               VALUE 'CST'.
 
                 88 PN-FPL               VALUE 'CNN'.
 
              10 OB-KEY-VDR-CD     PIC X(05).
 
                 88 VDR-MEDCO           VALUE 'MITSO'.
 
                 88 VDR-ESI             VALUE 'ESI  '.
 
                 88 VDR-CRMRK           VALUE 'MRMRK'.
 
              10 OB-KEY-C-NO      PIC X(11).
 
              10 OB-KEY-L-NO       PIC X(04).
 
              10 OB-KEY-DT          PIC X(0 .
 
              10 OB-KEY-TIME          PIC X(06).
 
              10 OB-KEY-DTA-L      PIC 9(04).
 
           05 OB-DATA                 PIC X(2000).
 
 
OB-DATA. First of all when use debugger i dont see that OB-DATA after input node. When tried to assign to the character still its null.
 
 
	DECLARE oData CHARACTER;
 
	SET oData = InputRoot.MRM.OB_DATA;
 
 
ImbRecoverableException caught from worker->parseNext.
 
 
Could u please help m eto resolve that issue?
 
 
Is this because of OB_DATA(2000) length string as i am using MRM parser? I read some where MRM parser has some msg length restrictions.
 
 
Thank You | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jbanoop | 
		  
		    
			  
				 Posted: Tue Jan 27, 2009 11:33 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Chevalier
 
 Joined: 17 Sep 2005 Posts: 401 Location: SC 
  | 
		  
		    
			  
				So did the import of thecopybook work ?
 
- While importing copybooks in 6.1 I had issues with the importer not liking the indentation of the copybook. Try to get all the elements below the 01 element at teh same indentation level. In my case it solved the import issue.
 
 
Did you set the MQInput node to have it parse the MRM message ? What exactly is the complete error being thrown ? Is a part of the message being parsed ? Check your data to ensure that it is being sent as per the copybook layout. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Bharat_123 | 
		  
		    
			  
				 Posted: Wed Jan 28, 2009 3:25 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 15 Sep 2008 Posts: 58
  
  | 
		  
		    
			  
				Hello Thanx for your reply.
 
 
Its copy book indentation problem. Checked with backend team they have copy book format checker. Its working fine now.
 
 
I have a specific question?
 
 
Can i assign CWF message values to XMLNSC?
 
 
i am in a strage sitidation
 
 
It worked for me picking up some values from MRM message and assigned to XMLNSC. But its populating me nothing when i try to assign whole MRM message to XMLNSC
 
 
CALL CopyMessageHeaders();
 
CALL CopyEntireMessage();
 
 
SET OutputRoot.MRM.MT_S_MQ_REQ = NULL;		
 
 
CREATE FIELD OutputRoot.XMLNSC.IProcure TYPE Name;
 
CREATE LASTCHILD OF OutputRoot.XMLNSC.IProcure.BMWtags.Inbound VALUE InputRoot.MRM.MT_S_MQ_REQ;
 
 
As i understand the values @ MRM side are BLOB. even i tried to assign that input string to a BLOB/ Char variable still didnt work.
 
		
 
Is there any way to handle this situation. I have this kind of situation in diff scenarios. 
 
 
The other scenario is Put the whole blob message into XMLtags. Still i am having same problem
 
 
 
Please help me to solve this problem
 
 
Thank You | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |