| Author | 
		  Message
		 | 
		
		  | raghuiib | 
		  
		    
			  
				 Posted: Mon Oct 01, 2018 12:14 pm    Post subject: Deleting contents in a SHARED ROW | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 01 Oct 2018 Posts: 11
  
  | 
		  
		    
			  
				Hello,
 
 
IIB 10.0.0.13
 
Msg Flow: Kafka Consumer node --> Compute
 
Flow is single threaded
 
 
Requirement:
 
Accumulate parts of the input data across a defined number of input messages, process them as a "batch". Once the batch is processed, reset the SHARED ROW (cache).
 
 
Kafka Consumer node receives Json messages.
 
Compute node stores parts of the input data into the SHARED ROW my_Cache.
 
A SHARED integer keeps count of the input messages.
 
 
   
	| Code: | 
   
  
	DECLARE my_Cache SHARED ROW;
 
DECLARE my_RecCnt SHARED INT 0; | 
   
 
 
 
   
	| Code: | 
   
  
	IF my_RecCnt = 0 THEN
 
     CREATE FIELD my_Cache.Record;
 
END IF; | 
   
 
 
 
The SHARED ROW is updated in this fashion:
 
   
	| Code: | 
   
  
	SET my_Cache.Record.data[1] = <data from 1st input msg>;
 
SET my_Cache.Record.data[2] = <data from 2nd input msg>;
 
.
 
.
 
.
 
SET my_Cache.Record.data[n] = <data from 3rd input msg>; | 
   
 
 
 
   
	| Code: | 
   
  
	IF my_RecCnt = n THEN
 
    ESQL to process all of the data in the SHARED ROW;                
 
    SET my_RecCnt = 0;
 
    DELETE FIELD my_Cache.Record;
 
END IF; | 
   
 
 
 
Issue:
 
When the "DELETE FIELD my_Cache.Record;" is executed, the following exception is thrown.
 
 
[							RecoverableException
 
									File:CHARACTER:/build/slot3/S1000_P/src/DataFlowEngine/MessageServices/ImbMessageGroup.cpp
 
									Line:INTEGER:201
 
									Function:CHARACTER:ImbMessageGroup::createParser
 
									Type:CHARACTER:
 
									Name:CHARACTER:
 
									Label:CHARACTER:
 
									Catalog:CHARACTER:BIPmsgs
 
									Severity:INTEGER:3
 
									Number:INTEGER:2310
 
									Text:CHARACTER:Could not create parser
 
									Insert
 
											Type:INTEGER:5
 
											Text:CHARACTER:]
 
 
I have tried:
 
SET my_Cache.Record = NULL;  -- Did not work
 
SET my_Cache = NULL;  -- Did not work
 
DELETE FIELD my_Cache.Record;  -- Did not work
 
 
 
Dear Experts,
 
Please let me know what I am missing?
 
This link has similar issue in a different scenario.
 
http://mqseries.net/phpBB/viewtopic.php?t=68951&postdays=0&postorder=asc&start=0&sid=24ab0be974fb027ee62a67cc40378b3a | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | raghuiib | 
		  
		    
			  
				 Posted: Mon Oct 01, 2018 2:04 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 01 Oct 2018 Posts: 11
  
  | 
		  
		    
			  
				Update...
 
 
This worked:
 
   
	| Code: | 
   
  
	DECLARE myRef REFERENCE TO my_Cache.Record;
 
DETACH myRef;
 
 | 
   
 
 
 
Per IBM docs, 
   
	| Quote: | 
   
  
	The DETACH statement detaches a portion of a message tree without deleting it
 
 | 
   
 
 
 
Since my DETACH operation is on a SHARED ROW, what are the implications for memory usage over time ? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Esa | 
		  
		    
			  
				 Posted: Mon Oct 01, 2018 11:38 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand Master
 
 Joined: 22 May 2008 Posts: 1387 Location: Finland 
  | 
		  
		    
			  
				I think you need to add a level in your tree. Like this:
 
 
   
	| Code: | 
   
  
	IF my_RecCnt = 0 THEN
 
     CREATE FIELD my_Cache.CacheData.Record;
 
END IF; | 
   
 
 
 
Then you should be able to 
 
 
   
	| Code: | 
   
  
	| DELETE FIELD my_Cache.CacheData.Record; | 
   
 
 
 
Btw. It seems a bit illogical to have several "data" elements under one "Record"... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | raghuiib | 
		  
		    
			  
				 Posted: Tue Oct 02, 2018 6:22 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 01 Oct 2018 Posts: 11
  
  | 
		  
		    
			  
				Esa,
 
 
I added another level to the cache tree.
 
   
	| Quote: | 
   
  
	| my_Cache.CacheData.Record | 
   
 
 
 
When it reaches 
 
   
	| Quote: | 
   
  
	| DELETE FIELD my_Cache.CacheData.Record; | 
   
 
 
 
it still throws this error:
 
   
	| Quote: | 
   
  
	| Could not create parser | 
   
 
 
 
I continue to research IBM documentation. Any help/directions is most appreciated. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Esa | 
		  
		    
			  
				 Posted: Thu Oct 04, 2018 12:28 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand Master
 
 Joined: 22 May 2008 Posts: 1387 Location: Finland 
  | 
		  
		    
			  
				OK, it seems you are doing some JSON specific stuff for your SHARED ROW and you haven't created a parser. DELETE probably detects a need to delete a parser, but the parser does not exist. Something like that.
 
 
You must explicitly create a parser for a tree that does not belong to OutputRoot.
 
 
   
	| Code: | 
   
  
	IF my_RecCnt = 0 THEN
 
     CREATE LASTCHILD of my_Cache.Record DOMAIN('JSON');
 
END IF; | 
   
 
 
 
and
 
 
   
	| Code: | 
   
  
	SET my_Cache.Record.JSON.Data.data[1] = <data from 1st input msg>;
 
SET my_Cache.Record.JSON.Data.data[2] = <data from 2nd input msg>;
 
  | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | raghuiib | 
		  
		    
			  
				 Posted: Fri Oct 05, 2018 5:28 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 01 Oct 2018 Posts: 11
  
  | 
		  
		    
			  
				Esa,
 
      
 
Thank you. You were correct. After adding the domain name when accessing the tree the issue went away. My input is a Json message and the code copies values from the input to the SHARED Row.
 
 
Sorry I could not reply sooner. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |