On Wed, 6 Mar 2024 18:10:28 -0600, Charles Mills <charl...@mcn.org> wrote:

>I am trying to sort a Rexx "array" starting with the second "word" of the 
>variables. My "array" is in Index.n and contains records of the form <nnnn 
>some descriptive string> where nnnn is 0001, 0002, 0003, etc. and string is 2 
>to 5 Rexx "words."
>
>Here's my Rexx code:
>
>  Say "Before sort" Index.0 Index.1 Index.2 Index.3
>  stdout.0 = 0
>  stderr.0 = 0
>  Call BPXWUNIX "/bin/sort -k2",Index.,Index.,stderr.
>  Do i = 1 to stderr.0
>    Say "Sort error:" stderr.i
>    End i
>  Say "After  sort" Index.0 Index.1 Index.2 Index.3
>
>And here is the output:
>
>Before sort 8 0001 Main Check 0002 OMVS (FTP Session) 0003 C Validation 
>After  sort 8 0001 Main Check 0002 OMVS (FTP Session) 0003 C Validation 
>
>My expectation is that -k2 would have caused sort to sort on the "descriptive 
>strings" (ignoring the nnnn) but obviously that is not what has happened. What 
>am I doing wrong? (I have tried both -k2 and -k 2, and also -k1 and +1 -- all 
>with the same results.)
>
>Thanks,
>Charles

Use a different Stem Name for the output, it can't be the same name as the 
input.

-- 
Dale R. Smith

----------------------------------------------------------------------
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