PROCEDURE define_tcpip_host (
  host_name: (var) string = $required
  forward_search_range: (var) string = $required)


" This procedure prompts the user to define the TCP/IP host.

"$ format = off
  VAR
    choice: string
    conversion_status: status
    cr_requested: string
    local_forward_search_range: string
    local_host_name: string
    selection: integer
    successful: boolean
  VAREND
"$ format = on

  local_forward_search_range = forward_search_range
  local_host_name = host_name

  main_loop: ..
    LOOP

 "$ format= off
    put_line ('1Define the TCP/IP host' ..
          '01. Define the TCP/IP Host Name.........................'//local_host_name ..
          ' 2. Define the TCP/IP Forward Search Range..............'//local_forward_search_range ..
          '0Enter a menu selection, QUIT, GO, or ?: ')
"$ format= on
      choice = ''

      accept_line choice input p=''

      IF choice = '1' THEN

        prompt_for_tcpip_host_name host_name=local_host_name

      ELSEIF choice = '2' THEN

        prompt_for_forward_search forward_search_range=local_forward_search_range

      ELSEIF (choice = '?') OR ($translate(lower_to_upper, choice) = 'HELP') THEN

"$ format = off
        put_line ('0This menu prompts you to define the TCP/IP host.' ..
              '0Enter a menu selection to define the TCP/IP Host Name or the TCP/IP' ..
              ' Forward Search Range. ' ..
              ' The Host Name (also known as the domain name) is a' ..
              ' string of 255 characters or less.  The domain name may be subdivided into ' ..
              ' domain labels.  Domain labels may be up to 63 characters in length. ' ..
              ' Domain labels are separated with periods.  Domain labels must begin ' ..
              ' with a letter (a..z or A..Z) and may be followed with 0 to 62 more ' ..
              ' letters, digits (0..9), hyphens (-), or underscores (_) with the exception ' ..
              ' of the last character which must be either a letter or a digit. ' ..
              ' For example, arh.cdc.q---_5 is a valid host name. ' ..
              ' The default value for the forward search range is 4. ' ..
              ' Enter GO or press NEXT to save the defined TCP/IP Host Name and/or the TCP/IP' ..
              ' Forward Search Range. ' ..
              ' Enter QUIT to return to the Define Network menu without defining the' ..
              '   TCP/IP Host.' ..
              '  ')
"$ format = on
        accept_line cr_requested input p='Press NEXT: '

      ELSEIF ($translate(lower_to_upper, choice) = 'QUIT') OR ($translate(lower_to_upper, choice) = 'QUI') ..
            THEN

        host_name = ' '
        EXIT_PROC

      ELSEIF (choice = ' ') OR ($translate(lower_to_upper, choice) = 'GO') THEN

        host_name = local_host_name
        forward_search_range = local_forward_search_range
        EXIT_PROC

      ELSE
        accept_line cr_requested input p='Invalid selection, press NEXT: '
      IFEND

    LOOPEND main_loop

PROCEND define_tcpip_host
