| Author | Message | 
		
		  | kr.danda | 
			  
				|  Posted: Tue Apr 15, 2014 6:36 am    Post subject: Characters Sorting in ESQL |   |  | 
		
		  | Novice
 
 
 Joined: 08 Apr 2014Posts: 15
 
 
 | 
			  
				|   
 Input File Message : BLOB Message
 
 LOLArece  jrepickedi   kjkkjwkejkwjejweweg
 LOAjrece   krepickedi  kjkkjwkejkwjejwewet
 OLArecei   repickedin  jkkjwkejkwjejwewerg
 JLArecei    lepickedin  jkkjwkejkwjejweweel
 ROLArec   arepickedi  kjkkjwkejkwjejwewei
 TOLArec   bvescontai  nerdatajbrepickedikjh
 
 Conditions :-
 The Second Columns Characters is sort alphabetic order.
 
 Flow:-
 FileInput Node ----> Compute Node ----> File Output Node
 
 
 Please  Help me...
 
 Thank You in Advance
 
 Regards,
 Karuna
 
 Last edited by kr.danda on Tue Apr 15, 2014 7:26 am; edited 1 time in total
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqsiuser | 
			  
				|  Posted: Tue Apr 15, 2014 6:41 am    Post subject: Re: Characters Sorting in ESQL |   |  | 
		
		  |  Yatiri
 
 
 Joined: 15 Apr 2008Posts: 637
 Location: Germany
 
 | 
			  
				| It is not really clear what you are asking for 
 You should first thoroughly search the forum (before asking a question / opening a new thread) !
 
 Probably this may help you: http://www.mqseries.net/phpBB2/viewtopic.php?t=66282
 _________________
 Just use REFERENCEs
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Tue Apr 15, 2014 7:58 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| you really don't want to do that in the broker. Write a file, sort the file according to that second column, ingest the sorted file...  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Tue Apr 15, 2014 8:05 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| 
   
	| fjb_saper wrote: |  
	| you really don't want to do that in the broker. Write a file, sort the file according to that second column, ingest the sorted file...  |  
               
 what's wrong with calling a static java function to sort a string?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Tue Apr 15, 2014 8:09 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| 
   
	| mqjeff wrote: |  
	| 
   
	| fjb_saper wrote: |  
	| you really don't want to do that in the broker. Write a file, sort the file according to that second column, ingest the sorted file...  |  
               
 what's wrong with calling a static java function to sort a string?
 |  on the nth character?
 Java is not the fastest way around to sort based on a column in an array of strings....
 
 Let's say tomorrow he wants to sort according to column 5 asc, column 2 desc, and column 9 asc.... for 2 million rows... of unknown length ?
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqjeff | 
			  
				|  Posted: Tue Apr 15, 2014 8:29 am    Post subject: |   |  | 
		
		  | Grand Master
 
 
 Joined: 25 Jun 2008Posts: 17447
 
 
 | 
			  
				| 
   
	| fjb_saper wrote: |  
	| 
   
	| mqjeff wrote: |  
	| 
   
	| fjb_saper wrote: |  
	| you really don't want to do that in the broker. Write a file, sort the file according to that second column, ingest the sorted file...  |  
               
 what's wrong with calling a static java function to sort a string?
 |  on the nth character?
 Java is not the fastest way around to sort based on a column in an array of strings....
 
 Let's say tomorrow he wants to sort according to column 5 asc, column 2 desc, and column 9 asc.... for 2 million rows... of unknown length ?
  |  
 I do not see any notion of sorting across columns.  Merely of sorting the characters within a single column.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kr.danda | 
			  
				|  Posted: Tue Apr 15, 2014 11:05 am    Post subject: Characters Sorting in ESQL |   |  | 
		
		  | Novice
 
 
 Joined: 08 Apr 2014Posts: 15
 
 
 | 
			  
				| Hi Every One.. 
 I don't want sort in Java...I Required ESQL code...Could Please Help me...
 
 
 Regards,
 karuna
  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqsiuser | 
			  
				|  Posted: Tue Apr 15, 2014 11:18 am    Post subject: Re: Characters Sorting in ESQL |   |  | 
		
		  |  Yatiri
 
 
 Joined: 15 Apr 2008Posts: 637
 Location: Germany
 
 | 
			  
				| Use "quicksort" _________________
 Just use REFERENCEs
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kr.danda | 
			  
				|  Posted: Tue Apr 15, 2014 6:44 pm    Post subject: Characters Sorting in ESQL |   |  | 
		
		  | Novice
 
 
 Joined: 08 Apr 2014Posts: 15
 
 
 | 
			  
				| Could Please give the Brief Explanation for Character sorting in ESQL 
  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqsiuser | 
			  
				|  Posted: Tue Apr 15, 2014 9:19 pm    Post subject: Re: Characters Sorting in ESQL |   |  | 
		
		  |  Yatiri
 
 
 Joined: 15 Apr 2008Posts: 637
 Location: Germany
 
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kr.danda | 
			  
				|  Posted: Wed Apr 16, 2014 7:06 am    Post subject: Characters Sorting in ESQL |   |  | 
		
		  | Novice
 
 
 Joined: 08 Apr 2014Posts: 15
 
 
 | 
			  
				| Sample Input Message :- Here Given the Four Characters...
 str1-    J
 str2-    A
 str3-    C
 str4-    D
 
 How can Take Implementation logic for Sorting Character.
 Please Guide Me.....
 
 Output Specification:-
 A
 C
 D
 J
 
 
  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Wed Apr 16, 2014 9:12 am    Post subject: Re: Characters Sorting in ESQL |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| 
   
	| kr.danda wrote: |  
	| Sample Input Message :- Here Given the Four Characters...
 str1-    J
 str2-    A
 str3-    C
 str4-    D
 
 How can Take Implementation logic for Sorting Character.
 Please Guide Me.....
 
 Output Specification:-
 A
 C
 D
 J
 
 
  |  
 So what have you tried: bubble sort, quadratic sort etc...?
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqsiuser | 
			  
				|  Posted: Wed Apr 16, 2014 10:11 am    Post subject: Re: Characters Sorting in ESQL |   |  | 
		
		  |  Yatiri
 
 
 Joined: 15 Apr 2008Posts: 637
 Location: Germany
 
 | 
			  
				| 
   
	| fjb_saper wrote: |  
	| So what have you tried: bubble sort, quadratic sort etc...?  |  
 quicksort is fastest and YOU SHOULD USE IT
  _________________
 Just use REFERENCEs
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | kimbert | 
			  
				|  Posted: Thu Apr 17, 2014 2:09 am    Post subject: |   |  | 
		
		  |  Jedi Council
 
 
 Joined: 29 Jul 2003Posts: 5543
 Location: Southampton
 
 | 
			  
				| If you really must use ESQL for this, then mqsiuser has provided you with the algorithm. Personally, I would call out to a Java method from ESQL.
 _________________
 Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | mqsiuser | 
			  
				|  Posted: Thu Apr 17, 2014 2:40 am    Post subject: |   |  | 
		
		  |  Yatiri
 
 
 Joined: 15 Apr 2008Posts: 637
 Location: Germany
 
 | 
			  
				| 
   
	| kimbert wrote: |  
	| If you really must use ESQL for this, then mqsiuser has provided you with the algorithm. |  I guess this quicksort is okay... mqjeff, fjb and others don't use it: It is nlogn and uses detach & attach (but it is still fine from my point of view)
 
 Can you use {} to sort
  !? 
 
 
   
	| kimbert wrote: |  
	| Personally, I would call out to a Java method from ESQL. |  You can't change the underlying datastructure in ESQL: It's a HashMap.
 
 In Java you can (I am not sure about Broker's Java). You could use a TreeMap and you could sort by inserting elements into it in logn (ending up with nlogn also)
 
 "Calling into Java": You have to implement the Comparable Interface (or make sure it is implemented as you want it to be) ...
 
 Anybody done that (in Broker) and wants to give some hints?
 _________________
 Just use REFERENCEs
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |