Re: What am I doing wrong with BPXWUNIX sort?

2024-03-07 Thread Charles Mills
Yes, that is exactly my impression. I have not run exhaustive experiments but I think that is it. Yes, for reasons related to other logic, this program contains Index. = "" but Sri's and my previous successful use of BPXWUNIX sort do not. CM On Thu, 7 Mar 2024 17:17:23 +, Jeremy Nicoll w

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-07 Thread Jeremy Nicoll
On Thu, 7 Mar 2024, at 16:54, Charles Mills wrote: > Thank you! THAT is the clue I needed. I need to quote the stem names. > Passing plain Index. passes "", the value of Index., to sort. So... the difference between your code & Sri's is that you'd initialised index. = "" whereas his didn't ha

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-07 Thread Charles Mills
Thank you! THAT is the clue I needed. I need to quote the stem names. Passing plain Index. passes "", the value of Index., to sort. Problem solved. Thanks all. CM On Thu, 7 Mar 2024 16:22:02 +, Alan Young wrote: >I think I have always used the position specification format. In a couple of

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-07 Thread Alan Young
Maybe sort is aborting with a return code (RC, retval, etc.) and no message? Alan -Original Message- From: IBM Mainframe Discussion List Sent: Mar 7, 2024 9:04 AM To: Subject: Re: What am I doing wrong with BPXWUNIX sort? Thanks all. The mystery deepens. Using the same stem variable shou

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-07 Thread Charles Mills
Thanks all. The mystery deepens. Using the same stem variable should not be the problem. I have done that before successfully, and the sort command documentation talks about how it uses a temporary file to avoid clobbering the input data if the files are the same. BUT ... changing to a differen

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-07 Thread Schmitt, Michael
same across all elements of the stem. If yours are variable length then the code will need to be adjusted. Maybe in your case it would need to be comparing subwords instead of substr. -Original Message- From: IBM Mainframe Discussion List On Behalf Of Charles Mills Sent: Wednesday,

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-06 Thread David Crayford
You’re using the same stem variable for input and output. Use a specific stdout. stem and see if that fixes it. Kolusu’s snippet works for me. > On 7 Mar 2024, at 8:41 am, Charles Mills wrote: > > Thanks. As I said, I have tried both -k2 and -k 2, and also -k1 and +1, all > with the same resu

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-06 Thread Dale R. Smith
On Wed, 6 Mar 2024 18:10:28 -0600, Charles Mills 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 some descriptive string> where is 0001, 0002, 0003, etc. and string is 2 >to 5 Rexx "word

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-06 Thread Charles Mills
Thanks. As I said, I have tried both -k2 and -k 2, and also -k1 and +1, all with the same result. CM On Thu, 7 Mar 2024 00:27:21 +, Sri Hari Kolusu wrote: >Charles, > >Try a space after k. -- For IBM-MAIN subscribe / sign

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-06 Thread Sri Hari Kolusu
Charles, Your example data /* REXX */ stdin.0=3 stdin.1="0001 Main Check" stdin.2="0002 OMVS (FTP Session)" stdin.3="0003 C Validation" cmd="sort -k 2" call bpxwunix cmd,stdin.,stdout.,stderr. say "stdout:" say "===" do i=1 to stdout.0 say stdout.i end say "stderr:" say "===" do i=1

Re: What am I doing wrong with BPXWUNIX sort?

2024-03-06 Thread Sri Hari Kolusu
Charles, Try a space after k. Something like this /* REXX */ stdin.0=5 stdin.1="KIJJ 3" stdin.2="KQWR 1" stdin.3="ADGF 2" stdin.4="OEPE 6" stdin.5="VNVV 5" cmd="sort -k 2" call bpxwunix cmd,stdin.,stdout.,stderr. say "stdout:" say "===" do i=1 to stdout.0 say stdout.i end say "stderr:"

What am I doing wrong with BPXWUNIX sort?

2024-03-06 Thread Charles Mills
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 where 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 stdo