in reply to Re: sort utility key specification
in thread sort utility key specification

I'd love to see flags for packed decimal fields.

Hm. I was under the impression that packed decimal fields sorted in correct numeric order when treated as strings?

Also, I don't know whether your n flag means that the sort routine expects binary values in your records, or text strings representing numbers.

Text representing numbers.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^3: sort utility key specification
by roboticus (Chancellor) on Apr 21, 2012 at 14:31 UTC

    BrowserUk:

    They do, until you throw in some negative numbers. They munge the sign into the last character.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      They do, until you throw in some negative numbers. They munge the sign into the last character.

      Ah yes. That's a pain to deal with.

      I'll look into how much work is involved -- there is also the issue of implied decimal points -- relative to the number of times it might get used.

      One question. What type character would you use for bcd?

      'b' is currently free, though I can see it might be useful for something else. 'd' is used and 'c' isn't particularly mnemonic.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        BrowserUk:

        I've not found the implied decimal points to be a problem, as all the files I work with have them at the same position, so the normal string sort with a touch of magic to handle the sign would be adequate.

        I don't really have a preference or a "gut feel" as what character would be easier to remember for this field type. I'd probably have to refer to the help text.

        (I *was* going to suggest EBCDIC sorting in my original response, but you mentioned "real requirements", and I think I've cared about EBCDIC less than 10 times, so I doubt I would ever use it.)

        Update: I thought I'd mention that every time I've dealt with implied decimals in my code, I tend to just treat them as integers anyway. I generally only format them with a period if I'm generating a report. If I'm just creating a summary file in a similar format, I just write them back, and the other application never knows that I just used integers internally.

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

        I remember meeting the issue when punching Cards for Cobol. C is certainly mnemonic to me - perhaps explaining it is all that's needed? Or perhaps everyone wants to forget those days.

        Regards,

        John Davies