Re: Sorting output from PIPE REXXVARS TOLOAD for dumping a stem variable

2008-05-06 Thread Fred Schmidt
On Mon, 05 May 2008 22:54:23 -0700, Rob van der Heij wrote:
What you do is you add an extra field to the record to sort them on,
and then drop that extra field again. Like this:
spec ws = fs . substr f2 of w1 1.10 r 1-* n | sort 1.10 | substr 11-*

Thanks Rob,

Is SUBSTR something I need to get from somewhere else? 

FPLSCB027E Entry point SUBSTR not found  
FPLSCA003I ... Issued from stage 12 of pipeline 1  
FPLSCA001I ... Running SUBSTR 11-*  
   148 *-*'PIPE REXXVARS' ,  
'|BUFFER' ,/* Get all input records 
now  */
'|DROP 1' ,/* Discard first line   */
'|CHANGE 1.2 /v /=/'  ,/*   */
'|JOIN 1' ,/* Combine varname with 
value */
'|LOCATE 1.2 /n /',/* Only lines with 
var=value  */
'|CHANGE 1.2 /n //'   ,/*   */
'|CASEI LOCATE /'varname'/'   ,/* Only lines with our 
varname*/
'|CASEI NLOCATE /VARNAME=/'   ,/* But not with this string 
  */
'|SPEC WS = FS . SUBSTR F2 OF W1 1.10 R 1-* N' ,  
'|SORT 1.10'   ,  
'|SUBSTR 11-*' ,  
'|CONSOLE' /* Output to the terminal  
*/
   +++ RC(-27) +++  

Regards,
Fred Schmidt
Department of Corporate and Information Services (DCIS)
Data Centre Services (DCS)
Northern Territory Government, Australia


Re: Sorting output from PIPE REXXVARS TOLOAD for dumping a stem variable

2008-05-06 Thread Rob van der Heij
On Tue, May 6, 2008 at 8:52 AM, Fred Schmidt [EMAIL PROTECTED] wrote:

 Ah, I got it to work by changing...

 spec ws = fs . substr f2 of w1 1.10 r 1-* n | sort 1.10 | substr 11-*

Right. The substr stage is fairly new. It's a bit cheaper than a
full spec stage. A popular alternative in this case would be not
chop 10 to remove the first 10 byte.

 Rob


Sorting output from PIPE REXXVARS TOLOAD for dumping a stem variable

2008-05-05 Thread Fred Schmidt
On Thu, 09 Nov 2006 19:45:36 -0800, Alan Ackerman wrote: (Was Re: 
Another PIPE how to)
REXXVARS TOLOAD produces strings like /TABLE.0101/value -- only there is 
no guarantee that 
the delimiter will be a slash. So instead, I always use:

PIPE rexxvars TOLOAD | pick 2.6 == /TABLE./ | ...

Note that the order of the variables will be random, so you might want to
use:

PIPE rexxvars TOLOAD | pick 2.6 == /TABLE./ | sort | ...

This, and the other proposed solutions to dumping stem variables' 
contents, do not sort the values correctly if there are more than 9 
values. Eg:...

A.0=12 
A.1=a 
A.10=j 
A.11=k 
A.12=l 
A.2=b 
A.3=c 
A.4=d 
A.5=e 
A.6=f 
A.7=g 
A.8=h 
A.9=i 

This is presumably because the stem index value is variable length. I've 
mucked around trying to get the sort order correct, without success.

Any ideas?

Regards,
Fred Schmidt
Department of Corporate and Information Services (DCIS)
Data Centre Services (DCS)
Northern Territory Government, Australia