PROCEDURE prompt_for_network_connect (
  device_info: string = $optional
  host_network_id: string = $optional
  system_id: (var) string = $optional
  add_element: (var) boolean = $optional
  lcu_entries: (var) integer = $optional
  status)


  "$FORMAT=OFF
  VAR
    choice: string
    configuration_file: string = '$local.'//$unique
    cr_requested: string
    ignore: status
    local_status: status
    system_identifier: string
    system_id_string: string = ' '
    temp_add: boolean
  VAREND
  "$FORMAT=ON"

main_loop: ..
  LOOP

    IF $substr(device_info,37,4) = 'ICA2' THEN
      IF system_identifier = ' ' THEN
        system_id_string = ' '
      ELSE
        system_id_string = system_identifier // '(16)'
      IFEND
    IFEND

"$ format=off
    put_line (..
     '1Define Network Connection for: '//$substr(device_info,5,36)..
     '0 '..
     '0Do you wish to add this element to the Network Configuration?'..
     '0    1. YES'..
     '0    2. NO'..
     '0Enter a menu selection, QUIT, GO, or ?: '..
     )
"$ format=on
    choice = ' '
    accept_line choice input p=''

    IF choice = '1' THEN
      temp_add = TRUE
      IF $substr(device_info,36,4) = 'ICA2' THEN
        prompt_for_system_id ica2 system_identifier

    ELSEIF choice = '2' THEN

      temp_add = FALSE

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

      EXIT main_loop

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

"$ format=off
      put_line (..
        '0With this menu you define a network connection between your mainframe and'..
        ' the CDCNET $2629_2 Integrated Communications Adapter (ICA-II) indicated'..
        ' in the menu title.'..
        '0You must specify the system identifier for the ICA-II. No default value'..
        ' is provided.' ..
        '0Enter a menu selection to supply a parameter.'..
        ' Enter GO or press NEXT to accept the parameters and return to the'..
        '   previous menu.'..
        ' Enter QUIT to return to the previous menu without changing the parameters.'..
        '  ')
"$ format=on
      accept_line cr_requested input p='Press NEXT:'

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

      IF ($substr(device_info,36,4)='ICA2') AND (system_identifier = ' ')  THEN
        accept_line cr_requested input p='System identifier needed, press NEXT: '
      ELSEIF temp_add THEN
        detach_file $fname(configuration_file) status=ignore
        generate_defhn host_network_id $fname(configuration_file//'.$eoi')
        generate_defnc device_info system_identifier $fname(configuration_file//'.$eoi')
        execute_task sp=logical_configuration_utility
          verify_network_configuration i=$fname(configuration_file) status=local_status
        quit
        detach_file $fname(configuration_file) status=ignore
        IF local_status.normal THEN
          system_id = system_identifier
          add_element = temp_add
          put_line ('0Parameters verified.' '  ')
          accept_line cr_requested input p='Press NEXT: '
          EXIT main_loop
        ELSE
          display_value local_status
          accept_line cr_requested input p='Press NEXT: '
        IFEND
      IFEND

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

  LOOPEND main_loop

PROCEND prompt_for_network_connect
