
  PROCEDURE [INLINE] bai$skip_to_next_record_header;

?? RIGHT := 110 ??

    manually_advance_to_next_block := FALSE;

    IF rhl <= block_info^.residual_block_length THEN
      next_record_header_p := ^tape_descriptor^.get_tape_block_buffer^
            [block_info^.current_block_byte_address + 1];
      IF (next_record_header_p^.unique_id = bac$record_header_unique_id) AND
            (next_record_header_p^.header_type <= UPPERVALUE (rh.header_type)) AND
            (next_record_header_p^.header_type >= LOWERVALUE (rh.header_type)) AND
            (next_record_header_p^.length <= UPPERVALUE (rh.length)) AND
            (next_record_header_p^.length >= LOWERVALUE (rh.length)) AND
            (next_record_header_p^.length <= block_info^.residual_block_length - rhl) THEN
        last_record_header_p := next_record_header_p;
        residual_data_length := last_record_header_p^.length;
        block_info^.current_block_byte_address := block_info^.current_block_byte_address + rhl;
        block_info^.residual_block_length := block_info^.residual_block_length - rhl;
      ELSE
        manually_advance_to_next_block := TRUE;
        no_header_read := TRUE;
        amp$set_file_instance_abnormal (file_identifier, ame$improper_record_header, call_block.operation,
              ' ', status);
      IFEND;

    ELSE
      get_data (file_identifier, operation, #LOC (rh), rhl, FALSE, {start_new_block=} TRUE,
            {convert_if_ebcdic =} FALSE, status);

      IF NOT status.normal THEN
        manually_advance_to_next_block := TRUE;
        no_header_read := TRUE;
      ELSEIF gfi^.positioning_info.record_info.transfer_count < rhl THEN
        residual_data_length := 0;
        IF (tape_descriptor^.volume_position = amc$eov) OR (tape_descriptor^.volume_position =
              amc$after_tapemark) THEN
          no_header_read := TRUE;
        ELSE
          manually_advance_to_next_block := TRUE;
          no_header_read := TRUE;
          amp$set_file_instance_abnormal (file_identifier, ame$improper_record_header, call_block.operation,
                ' ', status);
        IFEND;
      ELSEIF (rh.unique_id = bac$record_header_unique_id) AND
            (rh.header_type <= UPPERVALUE (rh.header_type)) AND
            (rh.header_type >= LOWERVALUE (rh.header_type)) AND (rh.length <= UPPERVALUE (rh.length)) AND
            (rh.length >= LOWERVALUE (rh.length)) AND (rh.length <= block_info^.residual_block_length) THEN
        last_record_header_p := ^tape_descriptor^.get_tape_block_buffer^
              [block_info^.current_block_byte_address + 1 - rhl];
        residual_data_length := rh.length;
      ELSE
        manually_advance_to_next_block := TRUE;
        no_header_read := TRUE;
        amp$set_file_instance_abnormal (file_identifier, ame$improper_record_header, call_block.operation,
              ' ', status);
      IFEND;
    IFEND;

    gfi^.positioning_info.record_info.transfer_count := 0;

    IF manually_advance_to_next_block THEN
      residual_data_length := 0;
      block_info^.current_block_byte_address := block_info^.current_block_byte_address +
            block_info^.residual_block_length;
      block_info^.residual_block_length := block_info^.residual_block_length -
            block_info^.residual_block_length;
      gfi^.positioning_info.record_info.file_position := amc$mid_record;
    IFEND;

  PROCEND bai$skip_to_next_record_header;
