| Author | 
		  Message
		 | 
		
		  | mbmqusr | 
		  
		    
			  
				 Posted: Tue Jul 02, 2013 2:29 pm    Post subject: [SOLVED] Using ASBITSTREAM with DFDL parsers | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Jul 2013 Posts: 9
  
  | 
		  
		    
			  
				Dear All
 
I am facing a problem. If you can please advise. This is the code below.
 
I am using WMB V8.0.02
 
 
 
   
	| Code: | 
   
  
	DECLARE vchar CHARACTER;
 
                
 
SET vchar = CAST(ASBITSTREAM(InputRoot.DFDL.ROOTRECORD.SUBTREE ENCODING InputRoot.MQMD.Encoding  CCSID InputRoot.MQMD.CodedCharSetId OPTIONS RootBitStream ) AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId ); | 
   
 
 
 
 
 
I am getting the Entire DFDL Tree as character, even though I am referring to a Subtree for the FieldReference parameter of the ASBITSTREAM function. 
 
 
I explored the OPTIONS, and stumbled upon choices like RootBitStream, FolderBitStream and like things. Looks like FolderBitStream is not supported for DFDL. And the way RootBitstream works, it will always give me the entire message as a bitstream, not just the Subtree.
 
 
Is my understanding correct?
 
 
If my understanding is correct, how do i achieve it alternatively?
 
 
Can please advise
 
 
Thank You
 
mbmqusr
  Last edited by mbmqusr on Wed Jul 03, 2013 10:05 am; edited 1 time in total | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Jul 02, 2013 2:39 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				You are correct that the DFDL domain does not support the FolderBitstream option.
 
 
There is an easy way to work around it. Create a DFDL tree in the local environment. Copy the subtree there, and then use ASBITSTREAM to convert it to a bitstream. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mbmqusr | 
		  
		    
			  
				 Posted: Tue Jul 02, 2013 2:51 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Jul 2013 Posts: 9
  
  | 
		  
		    
			  
				Thank You Kimbert
 
 
I didn't understand about local environment.
 
 
But, i tried doing this with no sucess.
 
 
   
	| Code: | 
   
  
	   DECLARE vchar CHARACTER;      
 
             
 
        
 
        SET Environment.DFDL.SUBTREE = InputRoot.DFDL.ROOTRECORD.SUBTREE;
 
        SET vchar = CAST(ASBITSTREAM(Environment.DFDL.SUBTREE ENCODING InputRoot.MQMD.Encoding  CCSID InputRoot.MQMD.CodedCharSetId OPTIONS RootBitStream ) AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId ); | 
   
 
 
 
Can you please advise? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mbmqusr | 
		  
		    
			  
				 Posted: Tue Jul 02, 2013 2:57 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Jul 2013 Posts: 9
  
  | 
		  
		    
			  
				Got it. You may have meant meant a DFDL structure in the localenvironment using CREATE... PARSE
 
 
Let me try that | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Jul 02, 2013 3:07 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				| Yes, that is exactly what I meant. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mbmqusr | 
		  
		    
			  
				 Posted: Tue Jul 02, 2013 3:17 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Jul 2013 Posts: 9
  
  | 
		  
		    
			  
				Thank You again Kimbert
 
 
Did you mean Environment or LocalEnvironment? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mbmqusr | 
		  
		    
			  
				 Posted: Tue Jul 02, 2013 3:52 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Jul 2013 Posts: 9
  
  | 
		  
		    
			  
				I am trying to create the DFDL domain in local environment or in environment. Both fails
 
 
   
	| Code: | 
   
  
	
 
CREATE LASTCHILD OF Environment.Variables
 
      DOMAIN('DFDL') 
 
      PARSE (ASBITSTREAM(InputRoot.DFDL.ROOTRECORD.SUBTREE ENCODING InputRoot.MQMD.Encoding  CCSID InputRoot.MQMD.CodedCharSetId)); | 
   
 
 
 
It gives a BIP5822 error saying 
 
 
   
	| Quote: | 
   
  
	| Cannot continue - messageTypeName is empty | 
   
 
 
 
Any ideas? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Wed Jul 03, 2013 12:38 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| Did you mean Environment or LocalEnvironment? | 
   
 
I meant what I said  . You are smart enough to work out which one you need.
 
 
   
	| Quote: | 
   
  
	| I am trying to create the DFDL domain in local environment or in environment. Both fails  | 
   
 
Yes. That is because you have failed to press 'start' on your brain.
 
Your code is 
 
1. Converting InputRoot.DFDL.ROOTRECORD.SUBRECORD to a sequence of bytes
 
2. Attempting to parse that sequence of bytes back into a message tree ( but you did not provide the name of a global element, so that fails )
 
3. Placing the resulting message tree as the last child of Environment.Variables.
 
 
I suggest that you change your code to
 
1. Create an element in the (Local)Environment, owned by the DFDL domain
 
2. Copy your subtree under that node.
 
This forum is full of examples that show how to do this ( most using the XMLNSC domain ). Please use the search button. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mbmqusr | 
		  
		    
			  
				 Posted: Wed Jul 03, 2013 9:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Jul 2013 Posts: 9
  
  | 
		  
		    
			  
				Sorry, I think I am not getting it
 
 
I tried following what you said Kimbert. Looks like I was not able to, thats why I still have a problem.
 
 
	
   
	| Code: | 
   
  
	CREATE LASTCHILD OF Environment.Variables
 
        DOMAIN 'DFDL';
 
 
        
 
        SET Environment.Variables.DFDL.SUBTREE = InputRoot.DFDL.ROOTRECORD.SUBTREE;
 
        
 
        DECLARE vchar BLOB;
 
        SET vchar = ASBITSTREAM(Environment.Variables.DFDL.SUBTREE ENCODING InputRoot.MQMD.Encoding   CCSID InputRoot.MQMD.CodedCharSetId); | 
   
 
 
 
It is not recognizing the Root element, and giving me an error 
 
 
Root element 'SUBTREE' in namespace '' does not exist.
 
 
Do i have to define the SUBTREE as a Global element in the same or another DFDL?
 
 
I am really not able to start my brain, it looks like | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mbmqusr | 
		  
		    
			  
				 Posted: Wed Jul 03, 2013 10:04 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 02 Jul 2013 Posts: 9
  
  | 
		  
		    
			  
				Solved, Finally. This is what I did
 
 
I created another DFDL Global Element called SUBTREE
 
 
And then this works
 
 
   
	| Code: | 
   
  
	   DECLARE parseOptions INTEGER BITOR(ValidateContentAndValue, ValidateException, ValidateComplete); 
 
        DECLARE vAcctNum CHARACTER;
 
        
 
        CREATE LASTCHILD OF Environment.Variables
 
        DOMAIN 'DFDL';
 
               
 
        SET Environment.Variables.DFDL.SUBTREE = InputRoot.DFDL.ROOTRECORD.SUBTREE;
 
        SET vAcctNum = CAST(ASBITSTREAM(Environment.Variables.DFDL.SUBTREE OPTIONS parseOptions ENCODING InputRoot.MQMD.Encoding  CCSID InputRoot.MQMD.CodedCharSetId TYPE '{}:SUBTREE') AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId); | 
   
 
 
 
Am i doing anything redundant? Or this is fine?
 
 
Thank You Kimbert | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Wed Jul 03, 2013 11:45 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				Glad you got it working.
 
 
I don't think you are doing anything redundant. You needed the CREATE...DOMAIN 'DFDL', as you now realize.
   
	| Quote: | 
   
  
	This is what I did
 
I created another DFDL Global Element called SUBTREE  | 
   
 
I don't see where you are doing that. The code looks the same in both of your last two posts. But it doesn't matter - the main thing is that the code is correct.
 
   
	| Quote: | 
   
  
	| I am really not able to start my brain, it looks like | 
   
 
I disagree - it seems to be operating normally now   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | FireDragon$layer | 
		  
		    
			  
				 Posted: Fri Feb 17, 2017 8:17 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 17 Feb 2017 Posts: 1
  
  | 
		  
		    
			  
				Hi pardon me if I'm wrong in reopening this thread.
 
 
I am able to parse a DFDL message successfully by using this code - 
 
   
	| Code: | 
   
  
	SET invMsgBlob = ASBITSTREAM(InputBody
 
      OPTIONS RootBitStream 
 
      ENCODING InputRoot.MQMD.Encoding
 
      CCSID InputRoot.MQMD.CodedCharSetId
 
      TYPE refToInvoiceVars.MessageType); | 
   
 
 
but the BLOB doesn't seem to have any data in it.
 
Any suggestions here??   
 
What is the correct CCSID and ENCODING i should be using to convert DFDL to BLOB ? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |