On Thu, 5 Nov 2015 23:13:34 -0500, John P. Baker wrote:

>Kirk,
>
>The following example illustrates what I am trying to do --
>
>Call BPXWUNIX "sort -k 3 -k 4 -k 1 -k 2", table_in., table_out., messages_out. 
>;
>
>In the above example, "table_in." in a stem variable containing the rows to be 
>sorted, "table_out." Is a stem variable into which the sorted rows are to be 
>written, and "messages_out." Is a stem variable into which any error messages 
>are to be written.
>
>The "-k n" parameters indicates the space/tab delimited fields which are to be 
>used as sort keys.
>
>The problem that I am experiencing is that the data is being sorted using the 
>ASCII collating sequence (i.e., numerics precede alphabetics).
>
>Which I get the table back, "B12" precedes "BBB".
>
>This makes the subsequent binary search subroutine fail since as far as it is 
>concerned, the rows contained in stem variable "table_out." are not sorted.
>
>There is an optional fifth parameter (another stem variable) which allows 
>environmental variable settings to be passed.
>
>I tried setting LC_COLLATE to no effect.
>
>Any recommendations will be most welcome.
>

Try setting LC_COLLATE=S370 or SAA

env.0=1
env.1='LC_COLLATE=S370'
Call BPXWUNIX "sort -k 3 -k 4 -k 1 -k 2", table_in., table_out., 
messages_out.,env.;

Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to