From: Charles Hottel on 10 Jan 2008 19:43 "Mr. G" <gronoworx(a)gmx.de> wrote in message news:aee81659-5d9a-4562-830f-b2bf1d70a7e3(a)z17g2000hsg.googlegroups.com... > Hi, > > Is it possible to program the Quicksort Algorithm recursive in Cobol? > > I know that it is possible to call SubPrograms with CALL "name" an > give the SubProgram some Data. > > What would happen if the SupProgram calls itself? Will that be real > recursive or doesn't that work? > > Does somebody already have a conclusion? > > Markus Google is your friend. Search google groups, comp.lang.cobol, for jazqsort: http://groups.google.com/group/comp.lang.cobol/browse_thread/thread/673c3c8b40d182bb/d831b92b2c05b4ca?hl=en&lnk=st&q=jazqsort+group%3Acomp.lang.cobol#d831b92b2c05b4ca
From: Robert on 10 Jan 2008 22:57 On Thu, 10 Jan 2008 08:20:35 -0600, "HeyBub" <heybub(a)gmail.com> wrote: >Robert wrote: >> But then, if it follows the 2002 Standard >> for SORT verb, you can sort a table in memory with one line of code. >Or use the SORT verb and let the operating system figure it out. You must be referring to the SyncSort operating system. I booted it on my Genius (as seen on TV). Now it not only chops, slices and dices, but also sorts the pieces into neat little heaps. That was on the Heapsort setting, of course. Then I took it to the laundry room, set it on Bubblesort, and dumped my clothes in. It worked, but performance sucked. It ran in n^2. The book said I could expect n(log n). Since there were only two buckets, white and colored, would Bucketsort have run faster? I couldn't find Coinsort, so I tried sorting my change with Shell Sort. It threw them all into the reject pile. Next time I'll try Pigeonhole or Bozo Sort.
From: Arnold Trembley on 10 Jan 2008 23:51 Mr. G wrote: > Hi, > > Is it possible to program the Quicksort Algorithm recursive in Cobol? > > I know that it is possible to call SubPrograms with CALL "name" an > give the SubProgram some Data. > > What would happen if the SupProgram calls itself? Will that be real > recursive or doesn't that work? > > Does somebody already have a conclusion? > > Markus It is certainly possible to code the Quicksort Algorithm in COBOL, using either recursion or iteration. Most traditional COBOL programmers will probably find iteration easier. Here's an interesting article on table sorting in COBOL. The author includes an example of Quicksort written in COBOL using iteration rather than recursion: http://home.att.net/~arnold.trembley/svalgard.htm Perhaps we can get Robert to post an example of a Radix Sort in COBOL, which he says is faster than Quicksort. With kindest regards, -- http://arnold.trembley.home.att.net/
From: Howard Brazee on 11 Jan 2008 10:16 On Fri, 11 Jan 2008 04:51:38 GMT, Arnold Trembley <arnold.trembley(a)worldnet.att.net> wrote: >Here's an interesting article on table sorting in COBOL. The author >includes an example of Quicksort written in COBOL using iteration >rather than recursion: >http://home.att.net/~arnold.trembley/svalgard.htm I have programmed the Quicksort in CoBOL to sort some large tables. It's fast, easy, and clear. That said, there should be no need for it - I should be able to CoBOL to sort it, and CoBOL should be able to tell the system to pick the best sort. But my shop's CoBOL can't do that.
From: William M. Klein on 11 Jan 2008 15:01
Howard, Aren't you using IBM COBOL? If so, you can (and I know I have posted this before). It isn't FASTSRT - or even totally "obvious" - but it does use DFSort or SyncSort to do the sorting. See: http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3pg32/1.12.10.2 Yes, I would like IBM to add the "native" table sort feature, but what you ask for is possible. P.S. At least on mainframes (IBM or otherwise) I would expect this technique often to use the system's "optimal" sort technique for the data involved. -- Bill Klein wmklein <at> ix.netcom.com "Howard Brazee" <howard(a)brazee.net> wrote in message news:ks1fo3h4b9htj8e011u1h016087ff1co2k(a)4ax.com... > On Fri, 11 Jan 2008 04:51:38 GMT, Arnold Trembley > <arnold.trembley(a)worldnet.att.net> wrote: > >>Here's an interesting article on table sorting in COBOL. The author >>includes an example of Quicksort written in COBOL using iteration >>rather than recursion: >>http://home.att.net/~arnold.trembley/svalgard.htm > > I have programmed the Quicksort in CoBOL to sort some large tables. > It's fast, easy, and clear. That said, there should be no need for > it - I should be able to CoBOL to sort it, and CoBOL should be able to > tell the system to pick the best sort. > > But my shop's CoBOL can't do that. |