Rob,

Thanks for those ideas and examples!

The first example looks pretty clever, and one I should be able to use
since we do use Pipes RTL.   And thanks for the more general-purpose
lead-pipes example, too.

While the first example looks pretty clever, it didn't work for me, at
least not at:
PIPINX560I CMS/TSO Pipelines, 5654-030/5655-A17 level 110C0008.
PIPINX086I CMS/TSO Pipelines, 5654-030/5655-A17 1.0112
(Version.Release/Mod) -
Generated 3 Dec 2010 at 11:10:08
Source: Princeton Runtime Distribution

Here's some sample input (which exposed a need for a PAD stage for the
inserted XEDIT command to match the file LRECL):
------------------------------
00A
010
007
004
005
009
006
001
003
002
008 eof

The Pipe ran with PIPEDEMO (well... using my shorter/alias PDEM MODULE
name) letting me observe the records flow through the pipe:

'PDEM (END ?)' ,
   '| xedit',
   '| sort' sortargs ,
   '| strliteral cond /:0 DELETE */' ,
   '| pad 80' ,                   /* Quick fix, will need coding to
automatically match file LRECL */
   '| x: if take' ,
   '| subcom xedit' ,
   '| xedit' ,
   '| x:'

After running the pipe, the file contains only:
:0 DELETE *
I experimented a lot with that, but don't even see why it would work since
it *seems* that the output of the sort should be deleted by the command
":0 DELETE *".  Instead, the command ends up as the only output record.
Why would the command even end up in the output file, and why would the
sorted records not be deleted, too?  What am I missing?

BTW, thanks for pointing out the newer STRLITERAL 'CONDitional' keyword,
and for such a concise example of "IF" -- learn something new every day.

Your second example works perfectly:
'PDEM (END ?)' ,
   '| XEDIT',
   '| SORT' sortargs ,
   '| o: FANOUT' ,
   '| TAKE FIRST 1' ,
   '| SPECS /:0 DELETE */' ,
   '| SUBCOM XEDIT' ,
   '? o:' ,
     '| XEDIT'

----------
enhanced learning mode: ON
Attempting to shorten the 2nd example even more by merging the:
   '| SPECS /:0 DELETE */' ,
   '| SUBCOM XEDIT' ,
into a single:
   '| SUBCOM XEDIT :0 DELETE *'
resulted in the command being greeted with message: Excessive options ":0
DELETE *"
The syntax in the Author's Edition lists:
>>--SUBCOM--word--+--------+--><
                  +-string-+
1) What makes that ":0 DELETE *" command string "excessive options"?
Entered from the XEDIT command line as "PIPE SUBCOM XEDIT :0 DELETE *" it
works just fine (implying that some other pipes factor is in play).
2) Why does FANOUT (default: STOP ALLEOF) end before passing all sort
output records to its primary *and* secondary output streams?
Could the ":0 DELETE *" have been executed (even though there was an
"excessive options" error message), deleting the file from XEDIT storage
before SORT and FANOUT had a chance to process them all?
3) Even changing 'TAKE FIRST 1' to 'TAKE LAST 1' (attempting to reduce the
in-storage record copies of the file) did not force the ":0 DELETE *" to
wait until the last sorted record had been output by SORT and FANOUT.
enhanced learning mode: OFF

You wrote "If the file were already fairly sorted"...  - I can't rely on
that.  I'm trying to define a general purpose diskless xedit pipe sort
idiom that I can copy/paste into almost any future code when needed.
Bubble sorts in XEDIT macro aren't very concise, either.  Besides, Pipes
lets one sort multiple ways on all kinds of columns and fields.

Thanks for your guidance!

Mike Walter
Aon Corporation
The opinions expressed herein are mine alone, not my employer's.




"Rob van der Heij" <[email protected]>

Sent by: "CMSTSO Pipelines Discussion List" <[email protected]>
12/08/2010 05:45 PM
Please respond to
"CMSTSO Pipelines Discussion List" <[email protected]>



To
[email protected]
cc

Subject
Re: Pipes SORT within XEDIT






On Thu, Dec 9, 2010 at 12:39 AM, Rob van der Heij <[email protected]>
wrote:

>    | sort ..
>    | strliteral cond /:0 DELETE */
>    | x: if take | subcom xedit | xedit | x:

As you guess, 'if' is my favorite after 'lookup' ;-)  If that style
bothers you, the traditional approach would be like

  \ xedit
  | sort
  | o: fanout
  | take
  | spec /:0 del */
  | subcom xedit
  \ o:
  | xedit

The records only come out of 'sort' when all data has been read and
sorted. The 'fanout' ensures that first the 'del *' is written, then
the records get to 'xedit'

| Rob





The information contained in this e-mail and any accompanying documents may 
contain information that is confidential or otherwise protected from 
disclosure. If you are not the intended recipient of this message, or if this 
message has been addressed to you in error, please immediately alert the sender 
by reply e-mail and then delete this message, including any attachments. Any 
dissemination, distribution or other use of the contents of this message by 
anyone other than the intended recipient is strictly prohibited. All messages 
sent to and from this e-mail address may be monitored as permitted by 
applicable law and regulations to ensure compliance with our internal policies 
and to protect our business. E-mails are not secure and cannot be guaranteed to 
be error free as they can be intercepted, amended, lost or destroyed, or 
contain viruses. You are deemed to have accepted these risks if you communicate 
with us by e-mail.

Reply via email to