*copyc osd$default_pragmats
MODULE iim$st_get;
?? NEWTITLE := 'MODULE iim$st_get' ??

?? PUSH (LISTEXT := ON) ??
*copyc amc$fap_request_codes
*copyc ame$terminal_validation_errors
*copyc amp$put_next
*copyc amt$file_byte_address
*copyc amt$file_position
*copyc amt$max_record_length
*copyc amt$skip_option
*copyc amt$transfer_count
*copyc amt$working_storage_length
*copyc cle$unseen_mail_condition
*copyc ifc$interrupt_timesharing_io
*copyc ife$error_codes
*copyc ife$interactive_exception_codes
*copyc iik$keypoints
*copyc iit$connection_description
*copyc i#ptr
*copyc jmt$dispatching_control_info
*copyc jmv$jcb
*copyc jmv$system_job_ssn
*copyc nae$application_interfaces
*copyc nae$namve_conditions
*copyc osc$unseen_mail_condition
*copyc oss$task_shared
*copyc ost$status
*copyc ost$wait
*copyc tmc$wait_times
*copyc tmv$null_global_task_id
*copyc pmp$log
*copyc iip$vt_input
?? POP ??

*copyc amp$set_file_instance_abnormal
*copyc bat$task_file_table
*copyc bav$last_tft_entry
*copyc bav$task_file_table
*copyc fsp$open_file
*copyc ifp$fap_control
*copyc ifp$st_fap_control
*copyc iip$clear_lock
*copyc iip$search_connection_desc
*copyc iip$set_lock
*copyc iip$st_flush
*copyc iip$st_put
*copyc jmp$handle_ts_io_req_failure
*copyc jmp$select_reset_disp_pr_r2
*copyc jmp$ts_io_request_valid
*copyc jmp$system_job
*copyc jmp$change_dispatching_prior_r1
*copyc jmp$select_reset_disp_pr_r2
*copyc osp$decrement_locked_variable
*copyc osp$disestablish_cond_handler
*copyc osp$establish_condition_handler
*copyc osp$increment_locked_variable
*copyc osp$set_status_condition
*copyc osp$system_error
*copyc osp$test_sig_lock
*copyc pmp$continue_to_cause
*copyc pmp$exit

*copyc iiv$interactive_terminated
*copyc iiv$int_task_open_file_count
*copyc iiv$io_requests_in_job
*copyc iiv$io_requests_in_task

?? NEWTITLE := 'PROCEDURE iip$st_get', EJECT ??

  PROCEDURE [XDCL, #GATE] iip$st_get (file_id: amt$file_identifier;
        open_file_desc_pointer: ^iit$st_open_file_description;
        operation: amt$fap_operation;
        working_storage_area: ^cell;
        working_storage_length: nat$data_length;
        record_length: ^amt$max_record_length;
        transfer_count: ^amt$transfer_count;
        byte_address: ^amt$file_byte_address;
        file_position: ^amt$file_position;
        skip_option: amt$skip_option;
    VAR status: ost$status);

      VAR
        exit_in_progress: boolean,
        connection_desc_ptr: ^iit$connection_description,
        current_transfer_count: amt$transfer_count,
        decrement_error: boolean,
        get_lock_set: boolean,
        input_information: [STATIC, oss$task_shared {NAMVE workaround}] iit$vt_input_information,
        io_requests_in_job: integer,
        local_status: ost$status,
        message_received,
        prompt_sent: boolean,
        null_dispatching_info: jmt$dispatching_control_info,
        put_byte_address: amt$file_byte_address,
        saved_attributes: iit$connection_attributes,
        skip_upline_block: boolean,
        temp_working_storage_area: ^cell,
        temp_working_storage_length: nat$data_length,
        timeout: iit$vt_timeout,
        vtp_transfer_count: nat$data_length;

?? NEWTITLE := 'FUNCTION eoi', EJECT ??

      FUNCTION eoi: boolean;

        { If the data just received is equal to the end_of_information
        { attribute
        { for this file instance return with eoi set to TRUE; otherwise, FALSE.

        VAR
          local_stat: ost$status,
          end_of_info: boolean,
          wsa_pointer: ^string (ifc$max_end_of_information_size);

        IF open_file_desc_pointer^.attributes.end_of_information.
          value.value (1, open_file_desc_pointer^.attributes.
          end_of_information.value.size) = $char(13) THEN
          IF connection_desc_ptr^.get_info.record_length = 0 THEN
            eoi := true;
          ELSE
            eoi := false;
          IFEND;
        ELSE
          end_of_info := (working_storage_area <> NIL) AND
            (open_file_desc_pointer^.attributes.end_of_information.value.
            size <> 0) AND (open_file_desc_pointer^.attributes.
            input_editing_mode.value = ifc$normal_edit) AND
            (connection_desc_ptr^.get_info.record_length =
            open_file_desc_pointer^.attributes.end_of_information.value.
            size);

          IF end_of_info THEN
            wsa_pointer := working_storage_area;
            end_of_info := (wsa_pointer^ (1, connection_desc_ptr^.get_info.
            record_length) = open_file_desc_pointer^.attributes.
            end_of_information.value.value (1, open_file_desc_pointer^.
            attributes.end_of_information.value.size));
          IFEND;
          eoi := end_of_info;
        IFEND;
      FUNCEND eoi;
?? OLDTITLE ??
  ?? NEWTITLE := 'PROCEDURE send_prompt', EJECT ??

      PROCEDURE send_prompt (prompt_allowed: boolean;
        VAR status: ost$status);

        VAR
          file_identifier: amt$file_identifier,
          file_id_is_valid: boolean,
          file_instance: ^bat$task_file_entry,
          prompt_file_has_format_effector: boolean,
          prompt_string_start_index: 1 .. ifc$max_prompt_string_size,
          format_effector_null_prompt: char,
          put_length: amt$working_storage_length,
          st_open_file_dsc_pointer: ^iit$st_open_file_description,
          put_byte_address: amt$file_byte_address;

        #KEYPOINT (osk$entry, 0, iik$send_prompt);
        status.normal := TRUE;

      { Ensure that the prompt file is open.

        IF open_file_desc_pointer^.attributes.prompt_file_identifier.value.ordinal = 0 THEN
          fsp$open_file (open_file_desc_pointer^.attributes.prompt_file.value,
                amc$record, NIL, NIL, NIL, NIL, NIL, open_file_desc_pointer^.attributes.
                prompt_file_identifier.value, status);
          IF NOT status.normal THEN
            #KEYPOINT (osk$exit, 0, iik$send_prompt);
            RETURN;
          IFEND;
        IFEND;

        put_length := 0;
        prompt_string_start_index := 1;
        iiv$put_info.build_msg_block := TRUE;

        IF (open_file_desc_pointer^.attributes.input_editing_mode.value = ifc$normal_edit)
              AND (prompt_allowed) AND
              (open_file_desc_pointer^.attributes.prompt_string.value.size <> 0) THEN

        { Determine whether or not the prompt file has format effectors.

          file_identifier := open_file_desc_pointer^.attributes.
            prompt_file_identifier.value;
*copy bai$validate_file_identifier
*copy iii$fetch_st_open_file_desc_ptr
          IF NOT status.normal THEN
            #KEYPOINT (osk$exit, 0, iik$send_prompt);
            RETURN;
          IFEND;
          prompt_file_has_format_effector := st_open_file_dsc_pointer^.
            format_effectors;

          put_length := open_file_desc_pointer^.attributes.prompt_string.value.size;

        { Discard the format effector of the prompt string if at mid record.

          IF (open_file_desc_pointer^.attributes.prompt_string.value.size <> 0) AND
                prompt_file_has_format_effector AND (iiv$put_info.last_term_option
                <> amc$terminate) THEN
            prompt_string_start_index := 2;
            put_length := open_file_desc_pointer^.attributes.prompt_string.value.size - 1;
          IFEND;

        { Output the prompt string.

          st_open_file_dsc_pointer^.attributes.input_editing_mode.value :=
            ifc$normal_edit;

          IF (put_length = 0) AND prompt_file_has_format_effector AND
                (iiv$put_info.last_term_option = amc$terminate) THEN
            format_effector_null_prompt := ifc$pre_print_no_positioning;
            put_length := 1;
            iip$st_put (open_file_desc_pointer^.attributes.prompt_file_identifier.value,
                  st_open_file_dsc_pointer, amc$put_partial_req,
                  ^format_effector_null_prompt,
                  put_length, ^put_byte_address, amc$terminate, status);
          ELSE
            iip$st_put (open_file_desc_pointer^.attributes.prompt_file_identifier.value,
                  st_open_file_dsc_pointer, amc$put_partial_req,
                    ^open_file_desc_pointer^.attributes.prompt_string.
                  value.value (prompt_string_start_index, 1), put_length, ^ put_byte_address,
                  amc$terminate, status);
          IFEND;

          iiv$put_info.build_msg_block := FALSE;

          IF NOT status.normal THEN
            #KEYPOINT (osk$exit, 0, iik$send_prompt);
            RETURN;
          IFEND;
        IFEND;

      { Output an iic$last_block for the get file id.
        iiv$put_info.term_char_null := TRUE;

        iip$st_put (file_id, open_file_desc_pointer, amc$put_partial_req,
              ^open_file_desc_pointer^.attributes.prompt_string.value.value
              (prompt_string_start_index, 1), 0, ^put_byte_address,
              amc$terminate, status);

        iiv$put_info.term_char_null := FALSE;
        iiv$put_info.build_msg_block := FALSE;

        IF NOT status.normal THEN
          #KEYPOINT (osk$exit, 0, iik$send_prompt);
          RETURN;
        IFEND;

        iip$st_flush (file_id, open_file_desc_pointer, status);
        IF NOT status.normal THEN
          #KEYPOINT (osk$exit, 0, iik$send_prompt);
          RETURN;
        IFEND;

        #KEYPOINT (osk$exit, 0, iik$send_prompt);

      PROCEND send_prompt;
  ?? OLDTITLE ??
  ?? NEWTITLE := 'PROCEDURE handle_break', EJECT ??

      PROCEDURE handle_break (cond: pmt$condition;
            cd: ^pmt$condition_information;
            sa: ^ost$stack_frame_save_area;
        VAR ch_status: ost$status);

        VAR
          iiv$condition_handler_trace: [XREF]  boolean,
          ls: ost$signature_lock_status,
          local_status: ost$status;


        CASE cond.selector OF
        = pmc$block_exit_processing =
          IF iiv$condition_handler_trace THEN
            pmp$log ('ST_GET block exit condition',local_status);
          IFEND;
          iiv$io_requests_in_task:= iiv$io_requests_in_task - 1;
          osp$decrement_locked_variable (iiv$io_requests_in_job, iiv$io_requests_in_job, io_requests_in_job,
                decrement_error);

          IF get_lock_set THEN
            IF iiv$condition_handler_trace THEN
              pmp$log ('ST_GET - get_lock_set entered',local_status);
            IFEND;
            osp$test_sig_lock (connection_desc_ptr^.st_get_lock, ls);
            IF ls = osc$sls_locked_by_current_task THEN
              iip$clear_lock (connection_desc_ptr^.st_get_lock, local_status);
            IFEND;
            get_lock_set := FALSE;
            #spoil (get_lock_set);
            connection_desc_ptr^.get_info.file_position := amc$eor;
          IFEND;

          osp$set_status_condition (ife$abort_get, status);

        = pmc$user_defined_condition =
          IF cond.user_condition_name = ifc$interrupt_timesharing_io THEN
            IF iiv$condition_handler_trace THEN
              pmp$log ('ST_GET interrupt_timesharing_io',local_status);
            IFEND;
            IF exit_in_progress THEN
              pmp$log ('Multiple ifc$interrupt_timesharing_io conditions received.', local_status);
            IFEND;
            pmp$continue_to_cause (pmc$execute_standard_procedure, ch_status);
            #KEYPOINT (osk$exit, 0, iik$st_get);
            exit_in_progress := TRUE;
            EXIT iip$st_get;

          ELSEIF cond.user_condition_name = osc$unseen_mail_condition THEN
            IF iiv$condition_handler_trace THEN
              pmp$log ('ST_GET unseen_mail_condition',local_status);
            IFEND;
            pmp$continue_to_cause (pmc$execute_standard_procedure, ch_status);
            osp$set_status_condition (cle$unseen_mail_condition, status);
            #KEYPOINT (osk$exit, 0, iik$st_get);
            EXIT iip$st_get;
          IFEND;

        ELSE
          ;
        CASEND;

        IF iiv$condition_handler_trace THEN
          pmp$log ('ST_GET continue_to_cause',local_status);
        IFEND;
        pmp$continue_to_cause (pmc$execute_standard_procedure, ch_status);
        IF exit_in_progress THEN
          #KEYPOINT (osk$exit, 0, iik$st_get);
          EXIT iip$st_get;
        IFEND;

      PROCEND handle_break;
  ?? OLDTITLE ??
  ?? EJECT ??

      #KEYPOINT (osk$entry, 0, iik$st_get);
    /st_get/
      BEGIN
        exit_in_progress := FALSE;

        prompt_sent := FALSE;
        get_lock_set := FALSE;
        #spoil(get_lock_set);
        #spoil (get_lock_set);
        skip_upline_block := FALSE;

{ The following procedure call causes the jobs priority to be reset. It is
{ support code for DYNAMIC DISPATCHING. This procedure calls a ring 1 procedure
{ which stores the global_taskid of this task (the interactive task) in the
{ IJL entry of the job. When the task is next readied, the priority of the job
{ will be reset, and the taskid in the IJL entry will be set to null. If
{ we exit this procedure with the taskid still in the IJL entry, the priority
{ of the job will be immediately reset. The situation will occur if the user
{ is typing ahead.

      jmp$select_reset_disp_pr_r2;

      { Protect the get lock with a handler for interactive conditions to
      { insure that they are recognized and the get lock gets cleared.

        osp$establish_condition_handler (^handle_break, TRUE);

        osp$increment_locked_variable (iiv$io_requests_in_job, iiv$io_requests_in_job, io_requests_in_job);
        iiv$io_requests_in_task := iiv$io_requests_in_task + 1;
        iip$search_connection_desc (open_file_desc_pointer^.session_layer_file_name, connection_desc_ptr);
        IF connection_desc_ptr = NIL THEN
          osp$set_status_condition (ife$file_is_not_network_file, status);
          EXIT /st_get/;
        IFEND;

        iip$set_lock (connection_desc_ptr^.st_get_lock, osc$wait, status);
        IF NOT status.normal THEN
          EXIT /st_get/;
        IFEND;
        get_lock_set := TRUE;
        #spoil (get_lock_set);

        WHILE NOT jmp$ts_io_request_valid () DO

          IF exit_in_progress THEN
            osp$system_error ('GET non-local exit did not complete.', NIL);
          IFEND;

          iiv$io_requests_in_task := iiv$io_requests_in_task - 1;
          osp$decrement_locked_variable (iiv$io_requests_in_job, iiv$io_requests_in_job, io_requests_in_job,
                decrement_error);
          IF get_lock_set THEN
            iip$clear_lock (connection_desc_ptr^.st_get_lock, local_status);
            get_lock_set := FALSE;
            #spoil (get_lock_set);
          IFEND;
          osp$disestablish_cond_handler;
          jmp$handle_ts_io_req_failure (status);
          IF status.normal THEN
            osp$establish_condition_handler (^handle_break, TRUE);
            osp$increment_locked_variable (iiv$io_requests_in_job, iiv$io_requests_in_job,
                  io_requests_in_job);
            iiv$io_requests_in_task := iiv$io_requests_in_task + 1;
            iip$set_lock (connection_desc_ptr^.st_get_lock, osc$wait, status);
            IF NOT status.normal THEN
              EXIT /st_get/;
            IFEND;
            get_lock_set := TRUE;
            #spoil (get_lock_set);
          ELSE
            RETURN;
          IFEND;
        WHILEND;

        IF NOT jmp$system_job() THEN
          connection_desc_ptr^.solicitation_pending := FALSE;
        IFEND;

      /loop_here_if_skip_upline_block/
        WHILE TRUE DO
          status.normal := TRUE;

        { Set up for data transfer.

          IF skip_option = amc$skip_to_eor THEN
            IF connection_desc_ptr^.get_info.file_position = amc$mid_record THEN

            { Position to EOR before receiving input by discarding buffered input data until
            { a logical end_of_message.

              connection_desc_ptr^.get_info.end_of_message := TRUE;
              IF connection_desc_ptr^.get_info.block_type = iic$last_block THEN
                skip_upline_block := FALSE;
                connection_desc_ptr^.get_info.file_position := amc$eor;
              ELSE
                skip_upline_block := TRUE;
              IFEND;
            IFEND;
          IFEND;

          IF (skip_option = amc$skip_to_eor) OR (connection_desc_ptr^.get_info.file_position <>
                amc$mid_record) THEN
            IF NOT prompt_sent THEN
              send_prompt ((NOT connection_desc_ptr^.solicitation_pending), status);
              prompt_sent := TRUE;
              IF NOT status.normal THEN
                EXIT /st_get/;
              IFEND;
            IFEND;
          IFEND;

        { Detect context switching and, if needed, blank the screen.

          IF (iiv$previous_mode = iic$screen) AND
                ((open_file_desc_pointer^.terminal_mode = iic$line) OR (file_id.ordinal <>
                iiv$previous_file_id.ordinal)) THEN
            iiv$previous_mode := iic$line;
            IF NOT iiv$previous_blank_flag THEN
              iiv$previous_blank_flag := TRUE;
              saved_attributes := open_file_desc_pointer^.attributes;
              open_file_desc_pointer^.attributes := iiv$previous_connection_attr;
            iip$st_put (file_id, open_file_desc_pointer, amc$put_next_req,
              #LOC (iiv$screen_clear_string.value), iiv$screen_clear_string.size,
              ^put_byte_address, amc$terminate, status);
              open_file_desc_pointer^.attributes := saved_attributes;
            IFEND;
          IFEND;

          iiv$previous_blank_flag := FALSE;
          IF open_file_desc_pointer^.terminal_mode = iic$line THEN
            iiv$previous_mode := iic$line;
          IFEND;
          iiv$previous_operation := operation;
          iiv$previous_file_id := file_id;

        { Initialize data transfer variables.

          IF connection_desc_ptr^.get_info.file_position <> amc$mid_record THEN
            connection_desc_ptr^.get_info.record_length := 0;
            connection_desc_ptr^.get_info.transfer_count := 0;
            connection_desc_ptr^.get_info.end_of_message := TRUE;
          IFEND;
          current_transfer_count := 0;
          temp_working_storage_area := working_storage_area;
          temp_working_storage_length := working_storage_length;

        /transfer_data_to_user/
          WHILE TRUE DO

          /get_data_from_network/
            REPEAT

              IF connection_desc_ptr^.get_info.end_of_message THEN
                connection_desc_ptr^.get_info.queued_data_length := 0;
              IFEND; { connection_desc_ptr^.get_info.end_of_message }

              timeout.on := open_file_desc_pointer^.attributes.input_timeout.value;
              IF timeout.on THEN
                timeout.length := open_file_desc_pointer^.attributes.input_timeout_length.value;
                timeout.purge := open_file_desc_pointer^.attributes.input_timeout_purge.value;
              IFEND;

{ The following procedure call causes the jobs priority to be reset. It is
{ support code for DYNAMIC DISPATCHING.

              jmp$select_reset_disp_pr_r2;

              iip$vt_input (open_file_desc_pointer^.vtp_connection_id, open_file_desc_pointer^.vtp_file_id,
                    temp_working_storage_area, temp_working_storage_length, timeout,
                    message_received, connection_desc_ptr^.get_info.end_of_message, vtp_transfer_count,
                    input_information, status);

              IF NOT status.normal THEN
                IF (status.condition = nae$no_data_available) OR (status.condition = nae$no_event)
                      OR (status.condition = nae$data_transfer_timeout) THEN
                  IF timeout.on THEN
                    IF timeout.length = 0 THEN
                      osp$set_status_condition (ife$no_data_available, status);
                    ELSE
                      osp$set_status_condition (ife$input_timeout_exceeded, status);
                    IFEND;
                    EXIT /st_get/;
                  ELSE
{!!                 Unexpected timeout code.  For R121 convert to cancel.  Someday do better.
{!!!}               input_information.cancel := TRUE;
                  IFEND;
                ELSE
                  connection_desc_ptr^.solicitation_pending := FALSE;
                  EXIT /st_get/;
                IFEND;
              ELSE
                connection_desc_ptr^.job_input_count :=
                  connection_desc_ptr^.job_input_count + vtp_transfer_count;
              IFEND;

              connection_desc_ptr^.solicitation_pending := FALSE;

              IF input_information.partial OR NOT
                    connection_desc_ptr^.get_info.end_of_message THEN
                connection_desc_ptr^.get_info.block_type := iic$continued_block;
                temp_working_storage_area := i#ptr (vtp_transfer_count,
                  temp_working_storage_area);
                temp_working_storage_length := temp_working_storage_length -
                  vtp_transfer_count;

              ELSE
                connection_desc_ptr^.get_info.block_type := iic$last_block;
              IFEND;
              connection_desc_ptr^.get_info.record_length := connection_desc_ptr^.get_info.record_length
                    + vtp_transfer_count;
              connection_desc_ptr^.get_info.queued_data_length := connection_desc_ptr^.get_info.
                    queued_data_length + vtp_transfer_count;
              connection_desc_ptr^.get_info.cancel_input := input_information.cancel;

              IF (working_storage_length <> 0) AND (vtp_transfer_count <> 0) THEN

              { Data has been moved to the user's working_storage_area and the
              { following variables are updated to account for this.

                current_transfer_count := current_transfer_count + vtp_transfer_count;
                connection_desc_ptr^.get_info.transfer_count := connection_desc_ptr^.get_info.transfer_count
                      + vtp_transfer_count;
              IFEND;

              IF (open_file_desc_pointer^.attributes.input_editing_mode.value = ifc$trans_edit) THEN
                IF input_information.editing_mode = 0 THEN
                  osp$set_status_condition (ife$xpt_mode_drop_unexpected, status);
                  { Note - do NOT return after setting this abnormal status }
                IFEND;
              IFEND;

            UNTIL (NOT input_information.partial) OR (input_information.cancel) OR
                  (connection_desc_ptr^.get_info.queued_data_length >= iic$max_cancellable_input) OR
                  (current_transfer_count = working_storage_length);
        { /get_data_from_network/ end }

            IF skip_upline_block THEN
              CYCLE /loop_here_if_skip_upline_block/;
            IFEND;

            IF (connection_desc_ptr^.get_info.cancel_input) THEN
              connection_desc_ptr^.get_info.file_position := amc$eor;
              connection_desc_ptr^.get_info.end_of_message := TRUE;
              connection_desc_ptr^.get_info.record_length := 0;
              connection_desc_ptr^.get_info.transfer_count := 0;
              current_transfer_count := 0;
              temp_working_storage_area := working_storage_area;
              temp_working_storage_length := working_storage_length;
              IF connection_desc_ptr^.get_info.queued_data_length < iic$max_cancellable_input THEN
                CYCLE /transfer_data_to_user/;
              IFEND;
            IFEND;

            IF (current_transfer_count = working_storage_length) OR (temp_working_storage_length <= 0) THEN
              EXIT /transfer_data_to_user/;
            IFEND;

            connection_desc_ptr^.get_info.end_of_message := TRUE;

            IF connection_desc_ptr^.get_info.block_type = iic$last_block THEN
              EXIT /transfer_data_to_user/;
            IFEND;

          WHILEND /transfer_data_to_user/;

        { Set proper post operation file position.

          IF connection_desc_ptr^.get_info.end_of_message AND (connection_desc_ptr^.get_info.block_type =
                iic$last_block) THEN
            connection_desc_ptr^.get_info.file_position := amc$eor;
          ELSE
            connection_desc_ptr^.get_info.file_position := amc$mid_record;
          IFEND;

        { Detect input cancellation.

          IF (connection_desc_ptr^.get_info.file_position = amc$eor) AND (connection_desc_ptr^.get_info.
                cancel_input) AND (connection_desc_ptr^.get_info.record_length > iic$max_cancellable_input)
                THEN
            amp$set_file_instance_abnormal(file_id, ame$max_cancellable_input,
                  operation, '', status);
          IFEND;

          EXIT /loop_here_if_skip_upline_block/;

        WHILEND /loop_here_if_skip_upline_block/;


      { Return parameters to the caller.

        IF record_length <> NIL THEN
          record_length^ := connection_desc_ptr^.get_info.record_length;
        IFEND;

        IF transfer_count <> NIL THEN
          transfer_count^ := current_transfer_count;
        IFEND;

        IF file_position <> NIL THEN
          file_position^ := connection_desc_ptr^.get_info.file_position;
        IFEND;

        IF byte_address <> NIL THEN
          byte_address^ := 0;
        IFEND;

      { Check for end-of-information.

        IF eoi() THEN
          IF record_length <> NIL THEN
            record_length^ := 0;
          IFEND;
          IF transfer_count <> NIL THEN
            transfer_count^ := 0;
          IFEND;
          IF file_position <> NIL THEN
            file_position^ := amc$eoi;
          IFEND;
          IF byte_address <> NIL THEN
            byte_address^ := 0;
          IFEND;

          connection_desc_ptr^.get_info.file_position := amc$eoi;

        IFEND; { IF eoi THEN }

      { Save access information.

        open_file_desc_pointer^.last_get_put_operation := operation;
        open_file_desc_pointer^.last_access_operation := operation;
        open_file_desc_pointer^.previous_record_length := connection_desc_ptr^.get_info.record_length;

      END /st_get/;
      #KEYPOINT (osk$exit, 0, iik$st_get);

      IF exit_in_progress THEN
        osp$system_error ('GET non-local exit did not complete.', NIL);
      IFEND;

{ Raise priority if it has not already been done.

      IF jmv$jcb.ijle_p^.interactive_task_gtid <> tmv$null_global_task_id THEN
        jmp$change_dispatching_prior_r1 (tmc$cpo_interactive_command, jmv$jcb.ijl_ordinal,
           jmv$jcb.system_name, null_dispatching_info, local_status);
      IFEND;

      iiv$io_requests_in_task := iiv$io_requests_in_task - 1;
      osp$decrement_locked_variable (iiv$io_requests_in_job, iiv$io_requests_in_job, io_requests_in_job,
            decrement_error);
      IF get_lock_set THEN
        iip$clear_lock (connection_desc_ptr^.st_get_lock, local_status);
        get_lock_set := FALSE;
        #spoil (get_lock_set);
      IFEND;
      osp$disestablish_cond_handler;

  PROCEND iip$st_get;

MODEND iim$st_get;
