Besides using DISK as Rob suggests, yoiu can use STATE to test if a file
exists. For example
'STATE NONE SUCH A'
if rc=0 then appendExtraFile='|APPEND < NONE SUCH A'
else AppendExtraFile=''
'PIPE .......,
AppendExtraFiles, /ยจ* Maybe append an extra file */
'|> FOO BAR A'
I feel that too few people realise they can use some REXX logic to construct
PIPE sections. The above example is too simple (one'd use APPEND DISK NONE
SUCH A), but you should see the principle.
P.S. and, you you run with ADDRESS COMMAND, the STATE command above will not
display a "file not found" on the console.
2010/11/23 Paul Gilmartin <[email protected]>
> On Nov 23, 2010, at 04:03, Rob van der Heij wrote:
>
> > On Tue, Nov 23, 2010 at 11:42 AM, Paul Gilmartin <[email protected]>
> wrote:
> >> First, I'm restricted to minidisks; my sysprog is stuck
> >> somewhere in the Twentieth Century. But I'd like to be
> >> able to delete an output file if the input file doesn't
> >> exist. So:
> >
> > Use the "disk" stage rather than the "<" if your input file is optional.
> >
> > The 'nose stage' verifies that your input file exists before raising
> > the commit level (and possibly doing irreversable things). In most
> > cases you don't want to wipe out files because of a missing input
> > file. Your case may be different.
> >
> Thanks. "commit" isn't really in my vocabulary. I don't think it
> existed when I first brushed against Pipelines, perhaps before SFS
> was a consideration.
>
> I might want to do things like:
>
> pipe disk FN1 FT1 A | locate NONEXISTENT | sort
> | xlate | ... | > FN2 FT2 A
>
> What stages must I beware of that might not raise the commit level
> until an input record is available? (What should I look for in the
> documentation?) I'd be most comfortable if I could put something
> just before the 'tail stage' that forced the commit level and passed
> its input stream unmodified, or unconditionally force commit in '>'.
>
> Thanks again,
> gil
>
--
Kris Buelens,
IBM Belgium, VM customer support