|
From: | Ron Norman |
Subject: | Re: [open-cobol-list] Sorting method, word by word or letter by letter. |
Date: | Tue, 8 Apr 2014 16:41:16 -0400 |
Hello John
Not sure I fully understand your question but here's some info that may be helpful:
1. Using the COBOL SORT verb to order data: SORT sort-file ON KEY k0, k1 ... kn
... when determining whether one record is less than, equal to or greater than another record, SORT compares each value of k from the two records in the order given.
1.1 if k is a COBOL NUMERIC then function cob_numeric_cmp() is used to compare the two values. This is the generic comparator for GNU COBOL numeric fields. So the result is the same as comparing two numeric fields in code.
1.2 otherwise: the two values are compared byte-by-byte (from left to right as they would appear in a string) using the COLLATING-SET declared for the COBOL module.
2. Using ORGANIZATION INDEXED
Strictly speaking, the key ordering depends on the underlying implementation you configure for ISAM: BDB, VBISAM, SQL, etc. In practice, I would be surprised if key-values were not compared byte-by-byte (from left to right as they would appear in a string).
For example: VBISAM uses the LINUX function memcmp() to compare two key values. This is documented as: "The memcmp() function compares the first n bytes (each interpreted as unsigned char) of the memory areas s1 and s2."
Would you like to elaborate and/or give an example of "sorted letter-by-letter and not word-by-word"?
Joe Robbins
address@hidden
________________________________________
From: john Culleton <address@hidden>
Sent: 05 April 2014 01:43
To: address@hidden
Subject: [open-cobol-list] Sorting method, word by word or letter by letter.
This is a technical distinction. My latest client
requires that an index be sorted letter-by-letter
and not word-by-word. Which method does GNUCOBOL
use?
--
John Culleton
Wexford Press
Free list of books for self-publishers:
http://wexfordpress.net/shortlist.html
PDF e-book: "Create Book Covers with Scribus"
available at
http://www.booklocker.com/books/4055.html
------------------------------------------------------------------------------
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees_APR
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list
[Prev in Thread] | Current Thread | [Next in Thread] |