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:
pipe literal wombat | > foo bar a
Ready; T=0.01/0.01 03:14:25
type foo bar a
wombat
Ready; T=0.01/0.01 03:14:35
pipe hole | > foo bar a
Ready; T=0.01/0.01 03:14:51
type foo bar a
DMSOPN002E File FOO BAR A not found
Ready(00028); T=0.01/0.01 03:14:58
Excellent! exactly what I wanted; an empty input stream erases
the output file. Now a more complicated test:
pipe literal wombat | > foo bar a
Ready; T=0.01/0.01 03:19:57
pipe < none such a | > foo bar a
FPLDSR146E File "NONE SUCH A1" does not exist
FPLSCA003I ... Issued from stage 1 of pipeline 1
FPLSCA001I ... Running "< none such a"
Ready(00146); T=0.01/0.01 03:23:54
type foo bar a
wombat
Ready; T=0.01/0.01 03:24:02
Ouch! Because of the error (I guess), the output file is not erased.
But, by trial and error, I can rescue it:
pipe hole | append < none such a | > foo bar a
FPLDSR146E File "NONE SUCH A1" does not exist
FPLMSG002I ... Processing "callpipe (name Append/Preface stagesep | escape ""
FPLMSG003I ... Issued from stage 2 of pipeline 1
FPLMSG001I ... Running "append < none such a"
FPLSCA004I ... Issued from stage 1 of pipeline 1 name "Append/Preface"
FPLSCA001I ... Running "< none such a"
Ready(00146); T=0.01/0.01 03:25:37
type foo bar a
DMSOPN002E File FOO BAR A not found
Ready(00028); T=0.01/0.01 03:25:45
... back to what I want. Is there a principle here I can rely on?
Is there a better way to delete the output file if the input file
is nonexistent?
(The error messages are ugly. But I'll live with them rather than
code a more complex pipeline.)
Thanks,
gil