*copyc osd$default_pragmats
MODULE rmm$request_terminal;

{MODULE DECK RMMRTT}
?? PUSH (LISTEXT := ON) ??
*copyc amc$condition_code_limits
*copyc amt$local_file_name
*copyc cle$ecc_file_reference
*copyc cle$ecc_lexical
*copyc clp$construct_path_handle_name
*copyc clp$get_ultimate_connection
*copyc clp$validate_name
*copyc clv$standard_files
*copyc fsc$local
*copyc fsp$path_element
*copyc fst$file_reference
*copyc fmp$request_terminal
*copyc ife$error_codes
*copyc iip$search_connection_desc
*copyc iip$xlate_local_file_to_session
*copyc iip$st_initialize_connection
*copyc iiv$connection_desc_ptr
*copyc iiv$int_task_open_file_count
*copyc iiv$interactive_terminated
*copyc jmp$system_job
*copyc jmv$connection_acquired
*copyc nat$data_fragments
*copyc osc$timesharing_terminal_file
*copyc osd$operating_system_exceptions
*copyc osp$append_status_parameter
*copyc osp$set_status_abnormal
*copyc oss$task_private
*copyc ost$status
*copyc osv$task_private_heap
*copyc pmp$get_job_mode
*copyc rme$request_terminal
*copyc rmp$get_device_class
?? POP ??

  PROCEDURE [XDCL, #GATE] rmp$r3_request_terminal
    (    terminal_file_name: ^fst$file_reference;
         term_conn_attributes: ift$connection_attributes;
     VAR evaluated_file_reference: {i/o} fst$evaluated_file_reference;
     VAR status: ost$status);

    TYPE
      set_of_cases = set of ift$connection_attribute_keys;

    VAR
      attributes: ^ift$connection_attributes,
      attributes_pointer: ^iit$connection_attributes,
      bam_status: ost$status,
      connection_desc_ptr: ^iit$connection_description,
      converted_name: ost$name,
      device_assigned: boolean,
      device_class: rmt$device_class,
      i: integer,
      index: ift$connection_attribute_keys,
      internal_terminal_name: amt$local_file_name,
      j: integer,
      job_mode: jmt$job_mode,
      k: integer,
      lnt_attributes: array [1 .. ORD (ifc$max_connection_key)] OF ift$connection_attribute,
      local_status: ost$status,
      path_handle_name: fst$path_handle_name,
      set_of_attribute_keys: set_of_cases,
      temp_file_name: amt$local_file_name,
      text: ost$name,
      validated_terminal_file_name: ost$name,
      ultimate_name: amt$local_file_name,
      ultimate_prompt_file: amt$local_file_name,
      valid_name: boolean;

    status.normal := TRUE;
    bam_status.normal := TRUE;
    text := osc$null_name;

  /request_terminal/
    BEGIN
      IF fsp$path_element (^evaluated_file_reference, 1)^ <> fsc$local THEN
        osp$set_status_abnormal (amc$access_method_id,
              cle$only_permitted_on_loc_file, '', status);
        EXIT /request_terminal/;
      IFEND;

      IF terminal_file_name = NIL THEN
        pmp$get_job_mode (job_mode, local_status);
        IF NOT local_status.normal THEN
          status := local_status;
          EXIT /request_terminal/;
        ELSEIF NOT (job_mode IN $iit$job_modes [jmc$interactive_connected,
               jmc$interactive_cmnd_disconnect, jmc$interactive_line_disconnect,
               jmc$interactive_sys_disconnect]) THEN
          osp$set_status_abnormal (ifc$interactive_facility_id,
               ife$current_job_not_interactive, 'RMP$R3_REQUEST_TERMINAL',
               status);
          EXIT /request_terminal/;
        IFEND;
        internal_terminal_name := osc$timesharing_terminal_file;
      ELSE
        IF STRLENGTH (terminal_file_name^) <= osc$max_name_size THEN
          internal_terminal_name := terminal_file_name^;
        ELSE
          osp$set_status_abnormal (ifc$interactive_facility_id,
                ife$file_name_ill_formed, terminal_file_name^, status);
          osp$append_status_parameter (osc$status_parameter_delimiter,
            'RMP$REQUEST_TERMINAL', status);
          EXIT /request_terminal/;
        IFEND;
      IFEND;

    { Validate the terminal file name.

      clp$validate_name (internal_terminal_name, validated_terminal_file_name, valid_name);
      IF NOT valid_name THEN
        osp$set_status_abnormal (amc$access_method_id, cle$improper_name, internal_terminal_name, status);
        EXIT /request_terminal/;
      IFEND;

    { Verify that the terminal file exists and that it is a network file.

      rmp$get_device_class (validated_terminal_file_name, device_assigned, device_class,
            status);
      IF NOT status.normal THEN
        EXIT /request_terminal/;
      IFEND;

      WHILE (device_assigned) AND (device_class = rmc$terminal_device) DO
        { chain from associated local file to find its session file }
        temp_file_name := validated_terminal_file_name;
        iip$xlate_local_file_to_session (temp_file_name, validated_terminal_file_name, status);
        IF NOT status.normal THEN
          EXIT /request_terminal/;
        IFEND;
        rmp$get_device_class (validated_terminal_file_name, device_assigned, device_class,
              status);
        IF NOT status.normal THEN
          EXIT /request_terminal/;
        IFEND;
      WHILEND;

      IF device_class = rmc$network_device THEN
        iip$search_connection_desc (validated_terminal_file_name, connection_desc_ptr);
        IF connection_desc_ptr = NIL THEN
        { Set up a terminal connection table and download the attributes.
          iip$st_initialize_connection (validated_terminal_file_name, status);
          IF NOT status.normal THEN
            EXIT /request_terminal/;
          IFEND;
          iip$search_connection_desc (validated_terminal_file_name, connection_desc_ptr);
        IFEND;
        attributes_pointer := ^connection_desc_ptr^.default_connection_attributes;
      ELSE {Must be Dual State
        attributes_pointer := iiv$terminal_request_ptr;
      IFEND;

    { Validate the attribute values and keys.

      IF UPPERBOUND (term_conn_attributes) <> 0 THEN

        FOR i := 1 TO UPPERBOUND (term_conn_attributes) DO
          CASE term_conn_attributes [i].key OF

          = ifc$attention_character_action =
            IF (term_conn_attributes [i].attention_character_action < LOWERVALUE
                  (ift$attention_character_action)) { } OR (term_conn_attributes [i].
                  attention_character_action > UPPERVALUE (ift$attention_character_action)) THEN
              text := 'ATTENTION_CHARACTER_ACTION';
            IFEND;

          = ifc$break_key_action =
            IF (term_conn_attributes [i].break_key_action < LOWERVALUE
                  (ift$break_key_action))
            { } OR (term_conn_attributes [i].break_key_action > UPPERVALUE
                  (ift$break_key_action)) THEN
              text := 'BREAK_KEY_ACTION';
            IFEND;


          = ifc$end_of_information =
            IF (term_conn_attributes [i].end_of_information.size < LOWERVALUE
                  (ift$end_of_information_size)) { } OR (term_conn_attributes
                  [i].end_of_information.size > UPPERVALUE
                  (ift$end_of_information_size)) THEN
              text := 'END_OF_INFORMATION';
            IFEND;

          = ifc$input_block_size =
            IF (term_conn_attributes [i].input_block_size < LOWERVALUE
                  (ift$input_block_size)) { } OR (term_conn_attributes
                  [i].input_block_size > UPPERVALUE
                  (ift$input_block_size)) THEN
              text := 'INPUT_BLOCK_SIZE';
            IFEND;

          = ifc$input_editing_mode =
            IF (term_conn_attributes [i].input_editing_mode < LOWERVALUE (ift$input_editing_mode))
            { } OR (term_conn_attributes [i].input_editing_mode > UPPERVALUE (ift$input_editing_mode))
                  THEN
              text := 'INPUT_EDITING_MODE';
            IFEND;

          = ifc$input_output_mode =
            IF (term_conn_attributes [i].input_output_mode < LOWERVALUE (ift$input_output_mode))
            { } OR (term_conn_attributes [i].input_output_mode > UPPERVALUE (ift$input_output_mode))
                  THEN
              text := 'INPUT_OUTPUT_MODE';
            IFEND;

          = ifc$input_timeout =
              IF (term_conn_attributes [i].input_timeout < LOWERVALUE (boolean))
              { } OR (term_conn_attributes [i].input_timeout > UPPERVALUE (boolean))
                    THEN
              text := 'INPUT_TIMEOUT'
            IFEND;

          = ifc$input_timeout_length =
              IF (term_conn_attributes [i].input_timeout_length < LOWERVALUE (ift$input_timeout_length))
              { } OR (term_conn_attributes [i].input_timeout_length > UPPERVALUE (ift$input_timeout_length))
                    THEN
              text := 'INPUT_TIMEOUT_LENGTH';
            IFEND;

          = ifc$input_timeout_purge =
              IF (term_conn_attributes [i].input_timeout_purge < LOWERVALUE (boolean))
              { } OR (term_conn_attributes [i].input_timeout_purge > UPPERVALUE (boolean))
                    THEN
              text := 'INPUT_TIMEOUT_PURGE';
            IFEND;

          = ifc$null_connection_attribute =
            ;

          = ifc$partial_char_forwarding =
              IF (term_conn_attributes [i].partial_character_forwarding < LOWERVALUE (boolean))
              { } OR (term_conn_attributes [i].partial_character_forwarding > UPPERVALUE (boolean))
                    THEN
              text := 'PARTIAL_CHARACTER_FORWARDING';
            IFEND;

          = ifc$prompt_file =

            clp$construct_path_handle_name (evaluated_file_reference.path_handle_info.path_handle,
                  path_handle_name);
            clp$get_ultimate_connection (path_handle_name, ultimate_name, status);
            IF NOT status.normal THEN
              EXIT /request_terminal/;
            IFEND;
            clp$get_ultimate_connection (term_conn_attributes [i].prompt_file, ultimate_prompt_file, status);
            IF NOT status.normal THEN
              EXIT /request_terminal/;
            IFEND;
            IF ultimate_prompt_file <> ultimate_name THEN
              clp$validate_name (term_conn_attributes [i].prompt_file, converted_name, valid_name);
              IF NOT valid_name THEN
                osp$set_status_abnormal (ifc$interactive_facility_id,
                      ife$prompt_file_name_ill_formed, term_conn_attributes [i].prompt_file, status);
                osp$append_status_parameter (osc$status_parameter_delimiter, 'RMM$REQUEST_TERMINAL', status);
                EXIT /request_terminal/;
              IFEND;

            { Verify that the file is assigned to a terminal device.

              rmp$get_device_class (converted_name, device_assigned, device_class, status);
              IF NOT status.normal THEN
                EXIT /request_terminal/;
              ELSE
                IF NOT device_assigned THEN
                  osp$set_status_abnormal (ifc$interactive_facility_id,
                        ife$prompt_file_name_not_found, converted_name,
                        status);
                  osp$append_status_parameter (osc$status_parameter_delimiter,
                    'RMM$REQUEST_TERMINAL', status);
                  EXIT /request_terminal/;
                ELSEIF device_class <> rmc$terminal_device THEN
                  osp$set_status_abnormal (ifc$interactive_facility_id,
                        ife$prompt_file_name_not_term, converted_name, status);
                  osp$append_status_parameter (osc$status_parameter_delimiter,
                    'RMM$REQUEST_TERMINAL', status);
                  EXIT /request_terminal/;
                IFEND;
              IFEND;
            IFEND;

          = ifc$prompt_file_identifier =

    { Get the file_name for the file_id.

    { The following code is no-op'ed until BAM provides a way to obtain
    { the local_file_name given the file_id.

    {       fetch_attributes [1].key := amc$local_file_name;
    {       amp$fetch (term_conn_attributes [i].prompt_file_identifier, fetch_attributes,
    {             status);
    {       IF NOT status.normal THEN
    {         EXIT /request_terminal/;
    {       IFEND;
    {
    {       clp$get_ultimate_connection (fetch_attributes [1].file_name^.local_file_name,
    {             ultimate_name, status);
    {       IF NOT status.normal THEN
    {         EXIT /request_terminal/;
    {       IFEND;
    {       clp$get_ultimate_connection (term_conn_attributes [i].prompt_file, ultimate_prompt_file, status);
    {       IF NOT status.normal THEN
    {         EXIT /request_terminal/;
    {       IFEND;
    {       IF ultimate_prompt_file <> ultimate_name THEN
    {
    {         clp$validate_name (fetch_attributes [1].file_name^.local_file_name, converted_name, valid_name);
    {         IF NOT valid_name THEN
    {           osp$set_status_abnormal (ifc$interactive_facility_id, ife$prompt_file_name_ill_formed,
    {                 fetch_attributes [1].file_name^.local_file_name, status);
    {           osp$append_status_parameter (osc$status_parameter_delimiter, 'RMM$REQUEST_TERMINAL', status);
    {           EXIT /request_terminal/;
    {         IFEND;
    {
    { Verify that the file is assigned to a terminal device.
    {
    {         rmp$get_device_class (converted_name, device_assigned, device_class, status);
    {         IF NOT status.normal THEN
    {           EXIT /request_terminal/;
    {         ELSE
    {           IF NOT device_assigned THEN
    {             osp$set_status_abnormal (ifc$interactive_facility_id,
    {                   ife$prompt_file_name_not_found, converted_name, status);
    {             osp$append_status_parameter (osc$status_parameter_delimiter,
    {               'RMM$REQUEST_TERMINAL', status);
    {             EXIT /request_terminal/;
    {           ELSEIF device_class <> rmc$terminal_device THEN
    {             osp$set_status_abnormal (ifc$interactive_facility_id,
    {                   ife$prompt_file_name_not_term, converted_name, status);
    {             osp$append_status_parameter (osc$status_parameter_delimiter,
    {               'RMM$REQUEST_TERMINAL', status);
    {             EXIT /request_terminal/;
    {           IFEND;
    {         IFEND;
    {       IFEND;

          = ifc$prompt_string =

            k := term_conn_attributes [i].prompt_string.size;
            IF ((k < LOWERVALUE (ift$prompt_string_size)) OR (k > UPPERVALUE
                  (ift$prompt_string_size))) THEN
              text := 'PROMPT_STRING';
            IFEND;

          = ifc$store_backspace_character =
            IF (term_conn_attributes [i].store_backspace_character < LOWERVALUE (boolean))
            { } OR (term_conn_attributes [i].store_backspace_character > UPPERVALUE (boolean)) THEN
              text := 'STORE_BACKSPACE_CHARACTER';
            IFEND;

          = ifc$store_nuls_dels =
            IF (term_conn_attributes [i].store_nuls_dels < LOWERVALUE (boolean))
            { } OR (term_conn_attributes [i].store_nuls_dels > UPPERVALUE (boolean)) THEN
              text := 'STORE_NULS_DELS';
            IFEND;

          = ifc$trans_character_mode =
            IF (term_conn_attributes [i].trans_character_mode <
                LOWERVALUE (ift$trans_character_mode))
            { } OR (term_conn_attributes [i].trans_character_mode >
                UPPERVALUE (ift$trans_character_mode)) THEN
              text := 'TRANS_CHARACTER_MODE';
            IFEND;

          = ifc$trans_forward_character =
            IF (term_conn_attributes [i].trans_forward_character.size <
                LOWERVALUE (ift$trans_fwd_char_size))
            { } OR (term_conn_attributes [i].trans_forward_character.size >
                UPPERVALUE (ift$trans_fwd_char_size)) THEN
              text := 'TRANS_FORWARD_CHARACTER';
            IFEND;

          = ifc$trans_length_mode =
            IF (term_conn_attributes [i].trans_length_mode < LOWERVALUE
                  (ift$trans_length_mode)) { } OR (term_conn_attributes [i].
                  trans_length_mode > UPPERVALUE (ift$trans_length_mode)) THEN
              text := 'TRANS_LENGTH_MODE';
            IFEND;

          = ifc$trans_message_length =
            IF (term_conn_attributes [i].trans_message_length < LOWERVALUE
                  (ift$trans_message_length))
            { } OR (term_conn_attributes [i].trans_message_length > UPPERVALUE
                  (ift$trans_message_length)) THEN
              text := 'TRANS_MESSAGE_LENGTH';
            IFEND;

          = ifc$trans_terminate_character =
            IF (term_conn_attributes [i].trans_terminate_character.size <
                LOWERVALUE (ift$trans_term_char_size))
                OR (term_conn_attributes [i].trans_terminate_character.size >
                UPPERVALUE (ift$trans_term_char_size)) THEN
              text := 'TRANS_TERMINATE_CHARACTER';
            IFEND;

          = ifc$trans_timeout_mode =
            IF (term_conn_attributes [i].trans_timeout_mode < LOWERVALUE (ift$trans_timeout_mode))
            { } OR (term_conn_attributes [i].trans_timeout_mode > UPPERVALUE (ift$trans_timeout_mode))
                  THEN
              text := 'TRANS_TIMEOUT_MODE';
            IFEND;

          = ifc$trans_protocol_mode =
            IF iiv$network_identifier = iic$dsiaf_network THEN
              IF iiv$cdcnet_connection THEN
                IF (term_conn_attributes [i].trans_protocol_mode < LOWERVALUE (ift$trans_protocol_mode))
                  { } OR (term_conn_attributes [i].trans_protocol_mode > UPPERVALUE (ift$trans_protocol_mode))
                  THEN
                    text := 'TRANS_PROTOCOL_MODE';
                IFEND;
              ELSE
                osp$set_status_abnormal (ifc$interactive_facility_id,
                  ife$illegal_nam_ccp_conn_change,
                  'RMM$REQUEST_TERMINAL', status);

                EXIT /request_terminal/;
              IFEND;
            ELSE
              IF (term_conn_attributes [i].trans_protocol_mode < LOWERVALUE (ift$trans_protocol_mode))
                { } OR (term_conn_attributes [i].trans_protocol_mode > UPPERVALUE (ift$trans_protocol_mode))
                THEN
                  text := 'TRANS_PROTOCOL_MODE';
              IFEND;

            IFEND;
          ELSE
            text := 'IMPROPER REQ ATTRIBUTE KEY';
            osp$set_status_abnormal (rmc$resource_management_id,
                  rme$improper_term_attrib_key, text, bam_status);
            status := bam_status;
            EXIT /request_terminal/;
          CASEND;

          IF text <> osc$null_name THEN
            IF bam_status.normal THEN
              osp$set_status_abnormal (rmc$resource_management_id,
                    rme$improper_term_attrib_value, text, bam_status);
            ELSE
              osp$append_status_parameter (osc$status_parameter_delimiter, text,
                    bam_status);
            IFEND;
            text := osc$null_name;
          IFEND;

        FOREND;
      IFEND; { UPPERBOUND (term_conn_attributes) <> 0 }

      IF bam_status.normal THEN

      { Store connection defaults set by CHATCD in the LNT along with the
      { attributes specified on this request, the latter having precedence.

        IF attributes_pointer = NIL THEN
          attributes := ^term_conn_attributes;
        ELSE

          j := 0;
        /search/
          FOR index := ifc$min_connection_key TO ifc$max_connection_key DO
            FOR i := 1 TO UPPERBOUND (term_conn_attributes) DO
              IF term_conn_attributes [i].key = index THEN
                j := j + 1;
                lnt_attributes [j] := term_conn_attributes [i];
                CYCLE /search/;
              IFEND;
            FOREND;

          { Attributes not specified on this REQT, i.e., not found in the above
          { FOR-loop, will be set to their CHATCD value if they were set by CHATCD.

            CASE index OF

            = ifc$attention_character_action =
              IF attributes_pointer^.attention_character_action.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].attention_character_action := attributes_pointer^.
                      attention_character_action.value;
              IFEND;

            = ifc$break_key_action =
              IF attributes_pointer^.break_key_action.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
              lnt_attributes [j].break_key_action :=
                    attributes_pointer^.break_key_action.value;
              IFEND;

            = ifc$end_of_information =
              IF attributes_pointer^.end_of_information.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].end_of_information :=
                      attributes_pointer^.end_of_information.value;
              IFEND;

            = ifc$input_block_size =
              IF attributes_pointer^.input_block_size.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].input_block_size := attributes_pointer^.
                      input_block_size.value;
              IFEND;

            = ifc$input_editing_mode =
              IF attributes_pointer^.input_editing_mode.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].input_editing_mode := attributes_pointer^.
                      input_editing_mode.value;
              IFEND;

            = ifc$input_timeout =
              IF attributes_pointer^.input_timeout.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].input_timeout := attributes_pointer^.input_timeout.value;
              IFEND;

            = ifc$input_timeout_length =
              IF attributes_pointer^.input_timeout_length.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].input_timeout_length := attributes_pointer^.
                      input_timeout_length.value;
              IFEND;

            = ifc$input_timeout_purge =
              IF attributes_pointer^.input_timeout_purge.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].input_timeout_purge := attributes_pointer^.
                      input_timeout_purge.value;
              IFEND;

            = ifc$input_output_mode =
              IF attributes_pointer^.input_output_mode.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].input_output_mode := attributes_pointer^.
                      input_output_mode.value;
              IFEND;

            = ifc$partial_char_forwarding =
              IF attributes_pointer^.partial_char_forwarding.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].partial_character_forwarding := attributes_pointer^.
                      partial_char_forwarding.value;
              IFEND;

            = ifc$prompt_file =
              IF attributes_pointer^.prompt_file.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].prompt_file := attributes_pointer^.prompt_file.value;
              IFEND;

            = ifc$prompt_file_identifier =
              IF attributes_pointer^.prompt_file_identifier.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].prompt_file_identifier := attributes_pointer^.
                      prompt_file_identifier.value;
              IFEND;

            = ifc$prompt_string =
              IF attributes_pointer^.prompt_string.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].prompt_string := attributes_pointer^.prompt_string.value;
              IFEND;

            = ifc$store_backspace_character =
              IF attributes_pointer^.store_backspace_character.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].store_backspace_character := attributes_pointer^.
                      store_backspace_character.value;
              IFEND;

            = ifc$store_nuls_dels =
              IF attributes_pointer^.store_nuls_dels.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].store_nuls_dels := attributes_pointer^.store_nuls_dels.value;
              IFEND;

            = ifc$trans_character_mode =
              IF attributes_pointer^.trans_character_mode.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].trans_character_mode := attributes_pointer^.
                      trans_character_mode.value;
              IFEND;

            = ifc$trans_forward_character =
              IF attributes_pointer^.trans_forward_character.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].trans_forward_character := attributes_pointer^.
                      trans_forward_character.value;
              IFEND;

            = ifc$trans_length_mode =
              IF attributes_pointer^.trans_length_mode.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].trans_length_mode := attributes_pointer^.
                      trans_length_mode.value;
              IFEND;

            = ifc$trans_timeout_mode =
              IF attributes_pointer^.trans_timeout_mode.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
              lnt_attributes [j].trans_timeout_mode := attributes_pointer^.
                    trans_timeout_mode.value;
              IFEND;

            = ifc$trans_message_length =
              IF attributes_pointer^.break_key_action.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].trans_message_length := attributes_pointer^.
                      trans_message_length.value;
              IFEND;

            = ifc$trans_terminate_character =
              IF attributes_pointer^.trans_terminate_character.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].trans_terminate_character := attributes_pointer^.
                      trans_terminate_character.value;
              IFEND;

            = ifc$trans_protocol_mode =
              IF attributes_pointer^.trans_protocol_mode.source =
                    ifc$change_term_conn_dflt_req THEN
                j := j + 1;
                lnt_attributes [j].key := index;
                lnt_attributes [j].trans_protocol_mode := attributes_pointer^.
                      trans_protocol_mode.value;
              IFEND;

            ELSE
              {}
            CASEND;
          FOREND /search/;

          PUSH attributes: [1 .. j];
          FOR i := 1 TO j DO
            attributes^ [i] := lnt_attributes [i];
          FOREND;
        IFEND; { iiv$terminal_request_ptr = NIL }

        fmp$request_terminal (^validated_terminal_file_name, attributes,
              evaluated_file_reference, status);
        IF NOT status.normal THEN
          EXIT /request_terminal/;
        IFEND;

      ELSE
        status := bam_status;
      IFEND; { bam_status.normal }

    END /request_terminal/;

  PROCEND rmp$r3_request_terminal;
MODEND rmm$request_terminal;
