1136.0.1: BASORT now includes three new sort types:
3: Integer (I1, I2, or I4)
4: "Natural" sort'
5: "Natural" sort (case insensitive)
"Natural" sort is based on an algorithm by Martin Pool which has spread to various other languages and attempts to mimic how humans would naturally sort strings such as "1 Main St", "10 Main St", "2 Main St". (The "natural" thing would be to sort "10 Main St" after "2 Main St", and treat 2 contiguous spaces as one, minimize importance of punctuation, etc., instead of just using the raw byte collating sequence.)
The A-Shell implementation deviates slightly from the original version by Martin Pool in that it supports the LDF collating sequence, if available, and doesn't require trailing nulls on the strings.
Natural sort keys should always be of type S (string).
Warning about using signed integer sort keys (B5, I1, I2 and I4) in files with a control record: traditionally the technique for preventing the control record from getting sorted out of place was to temporarily set it to all nulls, prior to sorting. But this is not adequate for signed integer sort keys, since nulls = 0, which is not at the bottom but in the middle of the range of signed values. The lowest possible signed integer value is -2^N where N is the # of bits in the field (e.g. -128, -32768, etc.) Similarly, for descending sort, the maximum value is 2^N-1.
1136.0.4: Up to 6 sort keys may now be passed to the random sort:
xcall BASORT,ch,reccnt,recsiz, k1siz,k1pos,k1ord,k2siz,k2pos,k2ord,k3pos,k3siz,k3ord, k1typ,k2typ,k3typ, k4siz,k4pos,k4ord,k5siz,k5pos,k5ord,k6pos,k6siz,k6ord, k4typ,k5typ,k6typ
1136.0. 5: The key type parameters may now be passed to the sequential sort:
xcall BASORT,chin,chout,recsiz,k1siz,k1pos,k1ord,k2siz,k2pos,k2ord, k3siz,k3pos,k3ord,k1typ,k2typ,k3typ
Previously, only plain string keys were supported, so there was no need for the k?typ parameters. Now you can specify 0 for string, or 4 for natural sort, or 5 for natural case-insensitive sort.