× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Rory Hewitt wrote:
As you can see, I didn't use the same-named fields that Booth used, because
I basically cut 'n' pasted my own code in there.

If you wanted, you could hold the buffer positions of the various fields in
the DS in a compile-time array and then simply use memcmp() or memicmp() in
sortproc. That would *greatly* simplify the code in sortproc()...


I wouldn't use memcmp or memicmp for comparing data structure subfields. It only works for fixed-length character, unsigned integer, *ISO dates and timestamps. For every other data type, doing a memory compare gives incorrect results.

For example, with zoned subfields, -456 (x'F4F5D6') compares greater than zoned 123 (x'F1F2F3'). Varying length 'abc' (x'0003818283') compares greater than 'b' (x'000182'). Varying length 'a' might not compare equal to 'a', depending on what junk followed the current data in each field.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.