PROCEDURE prompt_for_device_type (
  device_type: (var)  string = $optional
  status)

  "$FORMAT=OFF
  VAR
    choice: string
    display_choices: boolean = true
  VAREND
  "$FORMAT=ON"

  display_choices = true

device_type_loop: ..
  LOOP

    IF display_choices THEN
"$ format=off
      put_line (..
        '0Select the CDCNET device type from the list below:'..
        '01. Mainframe Terminal Interface (MTI) ' ..
        ' 2. Mainframe Device Interface (MDI)'..
        ' 3. Terminal Device Interface (TDI)' ..
        ' 4. Integrated Communications Adapter (ICA-II)' ..
        '  ')
"$ format=off
    IFEND
    accept_line choice input p='Enter menu selection or a ? for help: '
    IF choice = '?' THEN
      put_line (..
        '0- An MTI is a DI that is connected directly to a CYBER mainframe channel'..
        '   and which also has terminal communications lines connected to it.' ..
        ' - An MDI is a DI which is connected to a CYBER mainframe channel, '..
        '   and which has ethernet or other trunk lines connected to it. '..
        '   There are no communications lines attached to an MDI.'..
        ' - A TDI is a DI that is connected to other DIs by an ethernet or other ' ..
        '   trunk line and is not connected to any mainframe by a CYBER channel.'..
        '   A TDI does have communications lines attached to it.'..
        ' - An ICA-II is connected directly to the ethernet and'..
        '   does not have communications lines attached to it.'..
        '  ')
      display_choices = true
    ELSEIF choice = '1' THEN
      device_type = 'MTI'
      EXIT device_type_loop
    ELSEIF choice = '2' THEN
      device_type = 'MDI'
      EXIT device_type_loop
    ELSEIF choice = '3' THEN
      device_type = 'TDI'
      EXIT device_type_loop
    ELSEIF choice = '4' THEN
      device_type = 'ICA_II'
      EXIT device_type_loop
    ELSEIF choice = ' ' THEN
      EXIT device_type_loop
    ELSE
      put_line ('0Invalid menu selection, please correct. ', '  ')
      display_choices = false
    IFEND
  LOOPEND device_type_loop

PROCEND prompt_for_device_type
