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.

John P. Baker

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Kirk Wolf
Sent: Thursday, November 5, 2015 10:40 PM
To: [email protected]
Subject: Re: BPXWUNIX and sort

Have you looked at "man sort" for an explanation of the options that control 
ordering of keys?

Can you provide an isolated example of the sort command, its options and some 
data to illustrate your problem?

For example:

zos> sort   - <<EOF
abc
abd
aaa
EOF

aaa
abc
abd

Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Thu, Nov 5, 2015 at 7:49 PM, John P. Baker <[email protected]> wrote:

> I am using the BPXWUNIX service from a TSO/E REXX procedure to invoke 
> the OMVS sort command to sort a REXX stem variable.
>
> The sort works fine except that it uses the ASCII collating sequence 
> as opposed to the EBCDIC collating sequence.
>
> This makes the output stem variable unsuitable for use by a binary 
> search algorithm.
>
> Can anyone provide an example of how to make the sort command utilize 
> the EBCDIC collating sequence?
>
> John P. Baker
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions, send 
> email to [email protected] with the message: INFO IBM-MAIN
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to