STATUS='NEW' and 'REPLACE' require FILE= to be present.
STATUS='SCRATCH' may not appear with FILE=.
These errors are caught at compilation time when constant character
strings are used in an OPEN statement, but the runtime needs
to enforce them as well to catch errors in OPEN statements
with character variables and expressions.
Differential Revision: https://reviews.llvm.org/D122509
position_.reset();
}
}
+ if (status_) { // 12.5.6.10
+ if ((*status_ == OpenStatus::New || *status_ == OpenStatus::Replace) &&
+ !path_.get()) {
+ SignalError("FILE= required on OPEN with STATUS='NEW' or 'REPLACE'");
+ } else if (*status_ == OpenStatus::Scratch && path_.get()) {
+ SignalError("FILE= may not appear on OPEN with STATUS='SCRATCH'");
+ }
+ }
if (path_.get() || wasExtant_ ||
(status_ && *status_ == OpenStatus::Scratch)) {
unit().OpenUnit(status_, action_, position_.value_or(Position::AsIs),