}
else
{
- /* Let's make sure the file position is correctly set for the
- next read statement. */
+ /* Let's make sure the file position is correctly pre-positioned
+ for the next read statement. */
+ dtp->u.p.current_unit->current_record = 0;
next_record_r_unf (dtp, 0);
- us_read (dtp, 0);
generate_error (&dtp->common, ERROR_SHORT_RECORD, NULL);
return;
}
/* Check the action. */
if (read_flag && dtp->u.p.current_unit->flags.action == ACTION_WRITE)
- generate_error (&dtp->common, ERROR_BAD_ACTION,
- "Cannot read from file opened for WRITE");
+ {
+ generate_error (&dtp->common, ERROR_BAD_ACTION,
+ "Cannot read from file opened for WRITE");
+ return;
+ }
if (!read_flag && dtp->u.p.current_unit->flags.action == ACTION_READ)
- generate_error (&dtp->common, ERROR_BAD_ACTION,
- "Cannot write to file opened for READ");
-
- if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
- return;
+ {
+ generate_error (&dtp->common, ERROR_BAD_ACTION,
+ "Cannot write to file opened for READ");
+ return;
+ }
dtp->u.p.first_item = 1;
if ((cf & IOPARM_DT_HAS_FORMAT) != 0)
parse_format (dtp);
- if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
- return;
-
if (dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED
&& (cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT))
!= 0)
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "Format present for UNFORMATTED data transfer");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "Format present for UNFORMATTED data transfer");
+ return;
+ }
if ((cf & IOPARM_DT_HAS_NAMELIST_NAME) != 0 && dtp->u.p.ionml != NULL)
{
}
else if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED &&
!(cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT)))
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "Missing format for FORMATTED data transfer");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "Missing format for FORMATTED data transfer");
+ }
if (is_internal_unit (dtp)
&& dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED)
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "Internal file cannot be accessed by UNFORMATTED data transfer");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "Internal file cannot be accessed by UNFORMATTED "
+ "data transfer");
+ return;
+ }
/* Check the record or position number. */
if (dtp->u.p.advance_status != ADVANCE_UNSPECIFIED)
{
if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT)
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "ADVANCE specification conflicts with sequential access");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "ADVANCE specification conflicts with sequential access");
+ return;
+ }
if (is_internal_unit (dtp))
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "ADVANCE specification conflicts with internal file");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "ADVANCE specification conflicts with internal file");
+ return;
+ }
if ((cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT))
!= IOPARM_DT_HAS_FORMAT)
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "ADVANCE specification requires an explicit format");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "ADVANCE specification requires an explicit format");
+ return;
+ }
}
if (read_flag)
{
if ((cf & IOPARM_EOR) != 0 && dtp->u.p.advance_status != ADVANCE_NO)
- generate_error (&dtp->common, ERROR_MISSING_OPTION,
- "EOR specification requires an ADVANCE specification of NO");
+ {
+ generate_error (&dtp->common, ERROR_MISSING_OPTION,
+ "EOR specification requires an ADVANCE specification "
+ "of NO");
+ return;
+ }
if ((cf & IOPARM_DT_HAS_SIZE) != 0 && dtp->u.p.advance_status != ADVANCE_NO)
- generate_error (&dtp->common, ERROR_MISSING_OPTION,
- "SIZE specification requires an ADVANCE specification of NO");
-
+ {
+ generate_error (&dtp->common, ERROR_MISSING_OPTION,
+ "SIZE specification requires an ADVANCE specification of NO");
+ return;
+ }
}
else
{ /* Write constraints. */
if ((cf & IOPARM_END) != 0)
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "END specification cannot appear in a write statement");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "END specification cannot appear in a write statement");
+ return;
+ }
if ((cf & IOPARM_EOR) != 0)
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "EOR specification cannot appear in a write statement");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "EOR specification cannot appear in a write statement");
+ return;
+ }
if ((cf & IOPARM_DT_HAS_SIZE) != 0)
- generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
- "SIZE specification cannot appear in a write statement");
+ {
+ generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
+ "SIZE specification cannot appear in a write statement");
+ return;
+ }
}
if (dtp->u.p.advance_status == ADVANCE_UNSPECIFIED)
dtp->u.p.advance_status = ADVANCE_YES;
- if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
- return;
/* Sanity checks on the record number. */
if ((cf & IOPARM_DT_HAS_REC) != 0)