On Wed, 19 Mar 2025 at 05:00, Donald Russell <[email protected]> wrote:

> I have a pipeline that may produce output I want to replace an existing
> file with.
> If the pipeline doesn't produce any output, I don't want to erase the
> existing file.
>

Indeed, the idea is that ">" and others first verify that they can actually
do what they must (like write to that SFS directory). That's helpful for
when the pipeline also does other non-reversible things. It's probably more
obvious on input files. The process is a bit more subtle than you would
imagine; it's an area where I took two attempts to get it working.

Does this simple pipeline stage in REXX do what you meant?

  signal on error
  parse arg stage                   /* Stage like '> test file a'  */
  'peekto'                          /* Wait for record and commit  */
  'addpipe *.output: |' stage       /* Connect a pipeline          */
  'short'                           /* .. and get out of the way   */
  error: return rc * (rc <> 12)

There have been attempts before to create a generic PUTFILES which would
implicitly have this behavior. I think that never made it into CMS
Pipelines because there are a lot of choices to be made, and it's easier to
orchestrate the plumbing that does what you expect, than to generalize the
various options. Note that there is also the "diskreplace" configuration
variable, for when you're dealing with SFS files under the cover of a file
mode.

Sir Rob the Plumber

Reply via email to