
  PROCEDURE [INLINE] bai$validate_tape_access
    (    file_identifier: amt$file_identifier;
         access_mode: pft$usage_selections;
         operation: amt$fap_operation;
         tape_descriptor: ^bat$tape_descriptor;
     VAR status: ost$status);

?? PUSH (LISTEXT := ON) ??
    CASE operation OF

*copy bac$read_requests

      IF operation = amc$skip_req THEN
        tape_descriptor^.at_eoi := FALSE;
      ELSEIF NOT (pfc$read IN access_mode) THEN
        amp$set_file_instance_abnormal (file_identifier,
              ame$improper_access_attempt, operation, 'READ', status);
      IFEND;

*copy bac$write_requests

      IF tape_descriptor^.at_eoi THEN
        IF NOT ((pfc$append IN access_mode) OR (pfc$shorten IN access_mode))
              THEN
          amp$set_file_instance_abnormal (file_identifier,
                ame$improper_access_attempt, operation, 'APPEND or SHORTEN',
                status);
        IFEND;
      ELSEIF NOT (pfc$shorten IN access_mode) THEN
        amp$set_file_instance_abnormal (file_identifier,
              ame$improper_access_attempt, operation, 'SHORTEN', status);
      IFEND;

    ELSE
    CASEND;

  PROCEND bai$validate_tape_access;

*copyc ame$access_validation_errors
*copyc bat$task_file_table
*copyc ost$status
*copyc pft$usage_selections
*copyc amp$set_file_instance_abnormal
?? POP ??
