PROCEDURE prompt_for_network_id (
  network_type : key ethernet,ve, keyend = $required
  network : (var) string = $required
  status  : (var) status = $optional
  )

  create_variable input_string k=string
  create_variable conversion_status k=status
  create_variable integer_number k=integer

network_id_loop: ..
  LOOP
    put_line ' Enter a number in the range 1-0FFFF(16) or ? for help.'
    accept_line input_string input p=''
    IF (input_string = '?') OR ($translate(lower_to_upper, input_string) = 'HELP') THEN
      IF $string(network_type) = 'ETHERNET' THEN
        put_line (..
          '0Specify the network identifier of the ethernet to which the device' ..
          ' is connected.  That is, specify the identifier by which this network'..
          ' will be known within the CDCNET concatenated network (catenet).'..
          ' This identifier must be unique among all network identifiers assigned'..
          ' within this catenet.'..
          )
      ELSE
        put_line (..
          '0Specify the VE interface network identifier which is used to route' ..
          ' messages to the host through this device.  That is, the VE interface' ..
          ' identifier by which this network will be known within the CDCNET'..
          ' concatenated network (catenet).  This identifier must be unique among'..
          ' all network identifiers assigned within this catenet.'..
          '0A VE interface network identifier is required if more than one device' ..
          ' was defined during network configuration.'..
          )
      IFEND
      put_line (..
        '0To enter a hexadecimal value, append a radix of (16) to the number.'..
        '  ')
    ELSEIF input_string = ' ' THEN
      EXIT network_id_loop
    ELSE
      include_line 'integer_number=$integer(''0''//input_string)' status=conversion_status
      IF conversion_status.normal THEN
        IF (integer_number >= 1) AND (integer_number <= 0FFFF(16)) THEN
          $value(network) = $strrep(integer_number) // '(10)'
          EXIT network_id_loop
        ELSE
          put_line ('0Network identifier out of range, please correct.', '  ')
        IFEND
      ELSE
        display_value conversion_status
        put_line ('0Invalid network identifier, please correct.', '  ')
      IFEND
    IFEND
  LOOPEND network_id_loop

PROCEND prompt_for_network_id
