|  | $	_saved_verify = f$verify(0)
$ 	set noon
$ 	set control   = (t,y)
$!=============================================================================
$!
$!  Copyright (c) Digital Equipment Corporation, 1991 All Rights Reserved.
$!  Unpublished rights reserved under the copyright laws of the United States.
$!
$!  The software contained on this media is proprietary to and embodies the
$!  confidential technology of  Digital Equipment Corporation.  Possession,
$!  use, duplication or dissemination of the software and media is authorized
$!  only pursuant to a valid written license from Digital Equipment Corporation.
$!
$!
$!  RESTRICTED RIGHTS LEGEND   Use, duplication, or disclosure by the U.S.
$!  Government is subject to restrictions as set forth in Subparagraph
$!  (c)(1)(ii) of DFARS 252.227-7013, or in FAR 52.227-19, as applicable.
$!
$!                                      Digital Equipment Corporation
$!
$!=============================================================================
$!
$!  MCC_WAN4_AUTOCONFIG.COM | MCC_IP_AUTOCONFIG.COM
$!
$!  Command procedure to drive DNA4|IP data collection and map generation
$!  on VMS.
$!
$!=============================================================================
$!
$!  Modification History
$!
$!  Version	Date		Who	Comments
$!  -----------------------------------------------------------------------
$!  X11.00	28-MAY-1992     AVN     Restructured if-then-else statement
$!					in the routine GET_TOP_DIRECTORY
$!					Removed GOTO statement from inside the
$!                                      if-then-else statement to outside.
$!
$!  X10.00	15-MAY-1992   	UF	Removed version specs from purge
$!					statements to prevent DCL error.
$!					Modifed copy_map_files to print
$!					message correctly depending on option
$!					being processed (1 and 2 were
$!					switched).
$!					Fixed bug in files_created routine.
$!
$!  X9.00	13-MAY-1992   	UF	Modified delete_files to purge .cf*
$!					for DNA4 (not delete).
$!					Modified message printed when checking
$!					the namespace.
$!					Removed "DECmcc" from IP product name,
$!					to match DNA4.
$!					Modified to call copy_map_files after
$!					run_mcc_map in do_autoconfig, instead
$!					of in main routine.
$!					Modified print_intro to tell about
$!					"?" and "Q" at prompts.
$!					No longer support vertical backbone
$!					orientation.
$!					Modified text of question in
$!					ask_copy_map_files.
$!					Implemented logical name translation
$!					using f$parse in ask_copy_map_files.
$!					Modified display of main autoconfig
$!					options.
$!
$!  X8.00	 7-MAY-1992   	AV	Fixed the logic that checks directory
$!					spec.
$!
$!  X7.00	 9-APR-1992  	AV	Under option 5 for decnet seed node 
$!                                      question was not asked. Fixed some minor
$!                                      bugs too.
$!
$!  X6.00       08-APR-1992     UF      Few small changes to messages, etc.
$!
$!  X5.00       08-APR-1992     UF      If user enters "Q", always
$!				        quitscript_with_good_status, not
$!					abort_exit.
$!
$!  X4.00       08-APR-1992     UF      Modified get_top_directory to check
$!					for logical.  Check if directory
$!					exists before trying to set default!
$!
$!					Modified ABORT_EXIT to call
$!					quitscript_with_good status so
$!					".. exiting under error conditions"
$!					will not not be printed if user
$!					types "Q" in response to a prompt.
$!					Changed some error exit paths.
$!
$!  X3.00       03-APR-1992     UF      Edited help text; Fixed bugs in
$!                                      routines to get seed node, areas
$!					to include, and areas to exclude;
$!					Fixed formatting of some messages;
$!					Made other miscellaneous small changes.
$!
$!  X2.00	24-MAR-1992 	AV	Incorporated help text, prefix
$!                                      checking, etc.
$!
$!  X1.00	26-FEB-1992	UF	Original version, based on
$!					MCC_WAN4_AUTOCONFIG.COM.
$!
$!=============================================================================
$!
$!  File locations:
$!
$!    	executables			-  sys$library:
$!    	scripts				-  mcc_common:
$!    	autoconfiguration related files -  [<top directory>.DNA4.<domain name>]
$!
$!
$!=============================================================================
$!
$!  Specify which signals to trap
$!
$!  On Ultrix the following signals are trapped:
$!
$!	 1 = hangup
$!	 2 = interrupt
$! 	 3 = quit
$!      11 = segmentation violation
$!	15 = software termination (from kill(1))
$!
$!  	(<esc> may or may not be handled as signal 2)
$!
$!  On VMS we will trap ^T and ^Y
$!
$ 	on control_y then goto abort_exit
$       on warning then goto error_exit
$!
$       message_env              =   f$environment("MESSAGE")
$       set_message_off          =  "set message/nofacility/noidentification/noseverity/notext"
$       set_message_on           =  "set message''message_env'"
$       on_error_cont            =  "on error then continue"
$       on_ctrly_cont            =  "on control_y then continue"
$!
$	on_error_take_error_exit = "on error then goto error_exit"
$!
$!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$! 		Redefine some DCL command symbols to the original
$!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
$	DEFINE 	= "DEFINE"
$	READ 	= "READ"
$	WRITE 	= "WRITE"
$	OPEN 	= "OPEN"
$	DELETE 	= "DELETE"
$	COPY    = "COPY"
$!=============================================================================
$!
$!  Save the time when this procedure started, so we can list only those
$!  files created by this run.
$!
$!=============================================================================
$!
$	_START_TIME = F$TIME()
$!
$!=============================================================================
$!
$!  Symbol definitions
$!
$!=============================================================================
$!
$!-----------------------------------------------------------------------------
$!  General
$!-----------------------------------------------------------------------------
$!
$	general_product_name = "DECmcc Autoconfiguration"
$	prefix_file_name = "MCC_COMMON:MCC_AUTOCONFIG_PREFIX.DAT"
$!
$!-----------------------------------------------------------------------------
$!  DECnet Phase IV
$!-----------------------------------------------------------------------------
$!
$	dna4_topology            = "NICE"
$	dna4_dir                 = ".DNA4."
$       dna4_dir_help            = "DNA4"
$	dna4_product_name        = "DECnet Phase IV Autoconfiguration"
$!
$ 	decnet_range             = 25000
$       seed_node_list           = ""
$       seed_node_default_string = ""
$       query_all                = ""
$       area_exclude             = ""
$       area_include             = ""
$!
$!  No longer calling dna4_backbone().  Set defaults here.
$!
	SW_V_choice="1"
	SW_V=""
	report_backbone="[1] ! Horizontal"
$!
$!-----------------------------------------------------------------------------
$!  IP
$!-----------------------------------------------------------------------------
$!
$	ip_topology 		= "IP"
$	ip_dir 			= ".IP."
$       ip_dir_help             = "IP"
$	ip_product_name 	= "IP Autoconfiguration"
$!
$    	first_oid 		= 10000
$!
$!-----------------------------------------------------------------------------
$!  			Select Topology
$!-----------------------------------------------------------------------------
$!
$           Topology_Type = dna4_topology                                                  
$           product_name  = dna4_product_name                                              
$!                                                                                         
$!-----------------------------------------------------------------------------
$! 	When the following lines are uncommented, this command file will
$!	work as front end to DECmcc IP | WAN4 Autoconfiguration.
$!
$!	Note: Comment out the above two lins when the following
$!	      two lines are uncommented.
$!-----------------------------------------------------------------------------
$!
$!=>!<=     Topology_Type =  ip_topology                !=>!<=   Please also change         
$!=>!<=     product_name  =  ip_product_name            !=>!<=   NICE to IP in mcc command  
$!                                                      !        Look for "=>!<="           
$!-----------------------------------------------------------------------------
$!  General
$!-----------------------------------------------------------------------------
$       good_status         =  1
$       bad_status          =  0
$       echo                =  "Write sys$output"
$       ask                 =  "Inquire/nopunctuation"
$       exit_prompt         =  "o  Press RETURN to exit: "
$       _help_char          =  "?"
$       util_dir            =  "mcc_common:"
$       bin_dir             =   "sys$library:"
$       dnsctl 		    =   "mcr dns$control"
$       __domain_max_length =  10
$!-----------------------------------------------------------------------------
$!
$!=============================================================================
$!
$!  Define symbols for executables
$!
$!=============================================================================
$!
$     	if f$trnlnm("MCC_AC_MAP") .eqs. ""
$       then
$	    mcc_map   := $sys$library:MCC_AC_MAP.EXE
$       else
$	    mcc_map   = "$" + "''f$trnlnm("MCC_AC_MAP")'"
$     	endif
$!
$     	if f$trnlnm("MCC_AC_WAN4_COLLECTOR") .eqs. ""
$       then
$           nice_collector := $sys$library:MCC_AC_WAN4_COLLECTOR.EXE
$	else
$           nice_collector = "$" + "''f$trnlnm("MCC_AC_WAN4_COLLECTOR")"
$	endif
$!
$       if f$trnlnm("MCC_AC_WAN4_MAPPER") .eqs. ""
$       then
$          nice_mapper := $sys$library:MCC_AC_WAN4_MAPPER.EXE
$	else
$          nice_mapper = "$" + "''f$trnlnm("MCC_AC_WAN4_MAPPER") '"
$     	endif
$!
$    	if (f$trnlnm("MCC_AC_IP") .eqs. "")
$    	then
$           snmpmap := $'BIN_DIR'mcc_ac_ip.exe
$    	else
$           snmpmap = "$" + f$trnlnm("MCC_AC_IP")
$    	endif
$!
$	makeconfig  = "''UTIL_DIR'mcc_makeconfig.com"
$       EDTcommands = "''UTIL_DIR'mcc_ac_edt_init.dat"
$!
$!
$!=============================================================================
$!
$!  Set variables for directory and file specifications
$!
$!=============================================================================
$!
$	current_directory = F$TRNLNM("sys$disk") + F$DIRECTORY()
$!
$!=============================================================================
$!
$!  Let directories and files be owner and group writable.
$!
$!=============================================================================
$!
$	set protection=(owner:rwed,group:r)/default
$!
$!=============================================================================
$!
$!  Skip utility functions and to to start of script
$!
$!=============================================================================
$!
$	goto begin
$!
$!
$!=============================================================================
$!
$!  U T I L I T Y    F U N C T I O N S
$!
$!=============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : PRINT_INTRO
$!
$!  		Type topology-specific introductory message.
$!
$!  13-MAY-1992	UF	Modified to print information about responding
$!			to prompts with "?" or "Q".
$!-----------------------------------------------------------------------------
$!
$ PRINT_INTRO:
$!
$	echo ""
$	echo "        Welcome to ''product_name'"
$       echo ""
$       echo "        Type '?' for Help or 'Q' to Quit, at any of the prompts."
$       echo ""
$!
$    	return GOOD_STATUS
$!========================================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : QUITSCRIPT_WITH_GOOD_STATUS
$!
$!  Ask user to press RETURN to quit.  Exit with status = good_status.
$!
$!-----------------------------------------------------------------------------
$!
$ QUITSCRIPT_WITH_GOOD_STATUS:
$!
$	gosub do_clean_up
$	echo ""
$    	echo "        ''product_name' exiting."
$    	set def 'current_directory
$	echo ""
$!---------------
$ good_exit_confirm:
$!---------------
$    	ask any_char "''exit_prompt'"
$!
$	any_char = f$edit(any_char, "trim, upcase, compress")
$	any_char = F$EXTRACT(0, 1, any_char)
$	if any_char .eqs. _help_char
$ 	then
$	    _help_type = 8	! EXIT_HELP
$	    GOSUB print_help
$	    goto good_exit_confirm
$	endif
$!
$	_reset_verify = f$verify(_saved_verify)
$	EXIT good_status
$!
$!!    	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : QUITSCRIPT_WITH_BAD_STATUS
$!
$!  Ask user to press RETURN to quit.  Exit with status = bad_status.
$!
$!-----------------------------------------------------------------------------
$!---------------------------
$ QUITSCRIPT_WITH_BAD_STATUS:
$!---------------------------
$!
$	gosub do_clean_up
$	echo ""
$    	echo "        ''product_name' exiting under error conditions."
$    	set def 'current_directory'
$	echo ""
$!-----------------
$ bad_exit_confirm:
$!-----------------
$    	ask any_char "''exit_prompt'"
$!
$	any_char = f$edit(any_char, "trim, upcase, compress")
$	any_char = F$EXTRACT(0, 1, any_char)
$	if any_char .eqs. _help_char
$ 	then
$	    _help_type = 8	! EXIT_HELP
$	    GOSUB print_help
$	    goto bad_exit_confirm
$	endif
$!
$	_reset_verify = f$verify(_saved_verify)
$	EXIT good_status
$!
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : PRINT_HELP
$!
$!  Print context sensitive help for the user, based on the value
$!  of _HELP_TYPE.
$!
$!  Input:  _HELP_TYPE
$!
$!  13-MAY-1992   UF	Removed mention of "rightmost simplename" in help
$!			for DOMAIN.
$!-----------------------------------------------------------------------------
$!------------
$ PRINT_HELP:
$!------------
$	echo ""
$	echo "--------------------------------------------------------------------------------"
$!   1       2       3         4           5          6         7       8  
$! DOMAIN,TOPDIR,COPYFILES,AUTO_OPTION,YNCONTINUE,NAMESPACE,IP_CHOICE,EXIT
$!     9              10              11        12      13      14           15
$! DNA4_CONFIG,DNA4_SEARCH_METHOD,SEED_NODE,AREA_INCLUDE,EXCL,DNA4_BACKBONE,DOMAIN_OK
$!
$       help_choice = "1/2/3/4/5/6/7/8/9/10/11/12/13/14/15"
$ 	i = 0
$!------------------
$  check_help_choice:
$!------------------
$     label = f$element(i, "/", help_choice)
$!!
$!!   This is not possible as the input is from the program
$!!   if label .eqs. "/" then goto bad_choice		
$!!
$     if _help_type .eqs. label then goto help_'label'
$     i = i+1
$     goto check_help_choice
$!-------
$ help_1:		! DOMAIN
$!-------
$!
$ echo ""
$ echo "        Network entities discovered by ''product_name'"
$ echo "        must be registered before they can be managed by DECmcc."
$ echo ""
$ echo "        At the prompt, specify the name of the domain into which"
$ echo "        discovered entities should be placed during registration."
$ echo "        ''product_name' will use the"
$ echo "        ''general_product_name' prefix file to generate the"
$ echo "        fullname for the domain you specify."
$!
$	goto end_help
$!
$!-------
$ help_2:		! TOPDIR
$!-------
$!
$ echo ""
$ echo "        The configuration data collection and DECmcc Map file"
$ echo "        generation operations performed by ''product_name'"
$ echo "        result in the creation of a number of files.  These files are"
$ echo "        created in a subdirectory of the base directory you specify"
$ echo "        here."
$ echo ""
$ echo "        At the prompt, specify the directory which you would like"
$ echo "        ''product_name' to use as the base directory."
$ echo "        Please do not specify a logical name.  If not already present,"
$ echo "        ''product_name' will create the subdirectory 
$!
$	IF Topology_Type .EQS. dna4_topology
$	THEN
$           echo "        [.''dna4_dir_help'] in the directory you specify."
$       ELSE
$           echo "        [.''ip_dir_help'] in the directory you specify."
$       ENDIF
$!
$	goto end_help
$!
$!-------
$ help_3:		! COPYFILES
$!-------
$!
$ echo ""
$ echo "        DECmcc Map files generated by ''product_name'"
$ echo "        will be created in ""''working_dir'""."
$ echo "        If you are running ''product_name' from"
$ echo "        the DECmcc Iconic Map and you wish to view these DECmcc Maps"
$ echo "        without exiting DECmcc, answer "Y" to this question."
$!
$	goto end_help
$!
$!-------
$ help_4:		! AUTO_OPTION
$!-------
$!
$ echo ""
$ echo "        Choose option [1] at the prompt if you wish to collect"
$ echo "        configuration data and register entities found by"
$ echo "        ''product_name'.  Once option [1] is"
$ echo "        complete, you can display the DECmcc Maps which were"
$ echo "        created, and manage the entities found by"
$ echo "        ''product_name'."
$ echo ""
$ echo "        It is possible to view DECmcc Maps before running"
$ echo "        registration, using the DECmcc Map Snapshots option.  If"
$ echo "        you wish to do this, choose option [2] at the prompt."
$ echo "        This option is helpful if the scope of the collection is"
$ echo "        large, since registration may take significant time for a"
$ echo "        large area.  It is necessary to run registration, however,"
$ echo "        before you can manage the entities found by"
$ echo "        ''product_name'."
$ echo ""
$    	ask any_char "o  Press RETURN to continue: "
$ echo ""
$ echo "        You may reuse data obtained during an earlier data"
$ echo "        collection session, by chosing option [3] at the prompt."
$ echo "        Option [3] will produce DECmcc Registration and Map files"
$ echo "        using raw data saved in data files located in the working"
$ echo "        directory for the domain you have specified.  To register"
$ echo "        the entitites found by ''product_name',"
$ echo "        choose option [4] at the prompt."
$!
$	goto end_help
$!
$!-------
$ help_5:		! YNCONTINUE
$!-------
$!
$!	No-op
$!
$	goto end_help
$!
$!-------
$ help_6:		! NAMESPACE
$!-------
$!
$ echo ""
$ echo "        It is important that you complete namespace planning"
$ echo "        before running ''general_product_name'.  This includes"
$ echo "        reviewing the ''general_product_name' prefix file, as"
$ echo "        outlined in ""DECmcc Autoconfiguration and Autotopology Use""" 
$ echo "        manual."
$ echo ""
$ echo "        Please read this document before continuing."
$!
$	goto end_help
$!-------
$ help_7:		! IP_choice_help
$!-------
$!
$ echo ""
$ echo "        Your choice of configuration dictates the scope of"
$ echo "        data collection."
$ echo ""
$ echo "        The collection process can take a long time.  This time is"
$ echo "        dependent on the number of nodes to be discovered and the"
$ echo "        speed of the connections between nodes to be discovered.  "
$ echo ""
$ echo "        ''product_name' will create a default"
$ echo "        configuration specification, which you may use as a basis"
$ echo "        for your choice of configuration.  You must edit this file"
$ echo "        to specify and verify the choice of configuration, including"
$ echo "        choice of host name, gateway, etc."
$!
$	goto end_help
$!-------
$ help_8:		! Exit_help
$!-------
$!
$ echo ""
$ echo "        If you have invoked ''product_name'"
$ echo "        from the DECmcc Iconic Map, pressing RETURN at this"
$ echo "        point will cause the ''product_name'"
$ echo "        window disappear."
$ echo ""
$ echo "        If you would like to capture any messages that are"
$ echo "        currently displayed in this window, please do so before"
$ echo "        pressing RETURN."
$ echo ""
$ echo "--------------------------------------------------------------------------------"
$ echo ""
$!
$	goto no_quit_msg_exit
$!-------
$ help_9:	        ! DNA4_CONFIG
$!-------
$!
$ echo ""
$ echo "        Your choice of configuration dictates the scope of"
$ echo "        data collection."
$ echo ""
$ echo "        The collection process can take a long time.  This time is"
$ echo "        dependent on the number of nodes to be discovered and the"
$ echo "        speed of the connections between nodes to be discovered."
$ echo ""
$ echo "        ''product_name' has a node limit of 2000 nodes."
$ echo "        This limit should be considered when choosing a configuration."
$ echo ""
$ echo "        At the prompt, enter the number of the your configuration"
$ echo "        choice."
$!
$	goto end_help
$!--------
$ help_10:	        ! DNA4_SEARCH_METHOD
$!--------
$!
$ echo ""
$ echo "        ''product_name' collects configuration"
$ echo "        data by assembling a list of nodes to poll and by gathering"
$ echo "        information about each node in this list."
$ echo ""
$ echo "        This list can be generated in one of two ways, by"
$ echo "        ""adjacency search"" or ""address search"".  Using"
$ echo "        adjacency search, ''product_name' gathers"
$ echo "        information from nodes already found to discover"
$ echo "        additional nodes in the network.  Using the address search,"
$ echo "        ''product_name' polls all possible (1024)"
$ echo "        addresses in an area, gathering responses from any nodes"
$ echo "        with one of those addresses."
$ echo ""
$    	ask any_char "o  Press RETURN to continue: "
$ echo ""
$ echo "        Adjacency search is faster, but may not discover all nodes"
$ echo "        in an area.  Address search finds more nodes, but may take"
$ echo "        longer."
$ echo ""
$ echo "        Address search is recommended if the portion of your"
$ echo "        network for which you would like to collect data contains"
$ echo "        routers made by any vendor other than Digital."
$!
$	goto end_help
$!--------
$ help_11:	        ! SEED_NODE
$!--------
$!
$ echo ""
$ echo "        It is necessary to specify the node from which"
$ echo "        ''product_name' should start configuration data"
$ echo "        collection."
$ echo ""
$ echo "        It is possible to specify more than one starting node."
$ echo "        This is especially helpful, for instance, when a router does"
$ echo "        not support the NICE network management protocol.  In this"
$ echo "        case, you should specify a starting node on each side of the"
$ echo "        router."
$ echo ""
$ echo "        The starting node(s) you specify should be members of the"
$ echo "        area(s) which you would like to include in the data"
$ echo "        collection."
$ echo ""
$    	ask any_char "o  Press RETURN to continue: "
$ echo ""
$ echo "        If a starting node is not reachable from the system on which"
$ echo "        you are running ''product_name' or if a"
$ echo "        starting node is heavily protected, ''product_name'"
$ echo "        will encounter an error and data collection will stop."
$ echo ""
$ echo "        At the prompt, specify the starting nodes you would like"
$ echo "        ''product_name' to use, entering one node at a time."
$ echo "        Press RETURN to end the list."
$!
$	goto end_help
$!--------
$ help_12:	        ! AREA_INCLUDE
$!--------
$!
$ echo ""
$ echo "        ''product_name' is capable of collecting"
$ echo "        configuration data for more than one area in the network during"
$ echo "        one collection session, provided that the areas are directly"
$ echo "        connected together." 
$ echo ""
$ echo "        At the prompt, specify the areas you would like to include"
$ echo "        in the data collection, entering one node at a time.  Press"
$ echo "        RETURN to end the list."
$!
$	goto end_help
$!--------
$ help_13:	        ! EXCLUDE
$!--------
$!
$ echo ""
$ echo "        ''product_name' does not support collection of"
$ echo "        configuration information for hidden areas in your network."
$ echo ""
$ echo "        It is necessary to specify here all the hidden areas in your"
$ echo "        network, so that these areas can be excluded from the data"
$ echo "        collection."
$ echo ""
$ echo "        At the prompt, specify all hidden areas in your network,"
$ echo "        entering one node at a time.  Press RETURN to end the list."
$!
$	goto end_help
$!--------
$ help_14:	        ! DNA4_BACKBONE
$!--------
$!
$ echo ""
$ echo "        DECmcc Maps created by ''product_name'"
$ echo "        represent DECnet Phase IV backnones as a series of"
$ echo "        entities connected to either a horizontal or vertical line."
$ echo ""
$ echo "        If you wish backbones to be represented using a horizontal"
$ echo "        line, choose option [1].  Otherwise, choose option [2]."
$!
$	goto end_help
$!
$!-------
$ help_15:		! DOMAIN_OK
$!-------
$!
$ echo ""
$ echo "        Nodes discovered by ''product_name'"
$ echo "        must be registered before they can be managed"
$ echo "        from DECmcc."
$ echo ""
$ echo "        Verify the name of the domain into which discovered"
$ echo "        entities should be placed during registration.  If the"
$ echo "        name is correct, answer ""Y"" at the prompt.  Otherwise"
$ echo "        answer ""N"" and you will be given the opportunity to"
$ echo "        specify a new domain name."
$!
$	goto end_help
$!
$!------------
$ end_help:
$!------------
$!
$ echo ""
$ echo "        You may type "Q" to Quit ''product_name'."
$ echo ""
$ echo "--------------------------------------------------------------------------------"
$ echo ""
$    	ask any_char "o  Press RETURN to continue: "
$!-----------------
$ no_quit_msg_exit:
$!-----------------
$!
$	any_char = F$EDIT(any_char, "TRIM, UPCASE, COMPRESS")
$	IF any_char .EQS. "" THEN any_char = "Y"
$!
$	any_char = F$EXTRACT(0, 1, any_char)
$!
$	IF any_char .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	return GOOD_STATUS
$!
$!-----------------------------------------------------------------------------
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : GET_DOMAIN_NAME
$!
$!  Get domain name from user.
$!
$!  Input: _MCC_DOMAIN_PREFIX
$!
$!-----------------------------------------------------------------------------
$!------------------
$ get_domain_name:
$!------------------
$	echo ""
$	ask _MCC_DOMAIN "o  Please specify a domain: "
$!------------------
$ check_domain_name:
$!------------------
$	_mcc_domain = f$edit(_mcc_domain, "trim, upcase, compress")
$	if _mcc_domain .eqs. "Q" then gosub quitscript_with_good_status
$!
$	if _mcc_domain .eqs. _help_char
$ 	then
$	    _help_type = 1	! DOMAIN
$	    GOSUB print_help
$	    goto get_domain_name
$	endif
$!
$	if _mcc_domain .eqs. ""
$	then
$	    echo ""
$	    echo "        Error:  Domain name is required."
$	    GOTO GET_DOMAIN_NAME
$	ENDIF
$!
$	IF F$LENGTH(_MCC_DOMAIN) .GT. __DOMAIN_MAX_LENGTH
$	THEN
$	    echo ""
$	    echo "        Error:  Domain name is too long.  Name must be ''__DOMAIN_MAX_LENGTH'"
$	    echo "                characters or less."
$	    GOTO GET_DOMAIN_NAME
$	ENDIF
$!
$	IF F$LOCATE(".",_MCC_DOMAIN) .lt. F$LENGTH(_MCC_DOMAIN)
$ 	THEN
$	    echo ""
$	    echo "        Error:  Domain name cannot contain ""."""
$	    GOTO GET_DOMAIN_NAME
$	ENDIF
$!
$ VERIFY_DOMAIN:
$!
$	echo ""
$	echo "        Based on the prefix file on your system"
$	echo "        ''product_name' will use the domain"
$	echo "        ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$	echo ""
$       ask ok "o  Is ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'"" the correct domain name? Y/N [Y]: "
$!
$	ok = F$EDIT(ok, "TRIM, UPCASE, COMPRESS")
$	IF ok .EQS. "" THEN ok = "Y"
$!
$	ok = F$EXTRACT(0, 1, ok)
$	IF ok .EQS. "Y" THEN GOTO GOT_DOMAIN
$!
$	IF ok .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF ok .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 15	! DOMAIN_OK
$	    GOSUB print_help
$	    GOTO VERIFY_DOMAIN
$	ENDIF
$!
$	IF ok .EQS. "N"
$	THEN
$	    GOTO GET_DOMAIN_NAME
$	ELSE
$	    GOTO VERIFY_DOMAIN
$	ENDIF
$!
$ GOT_DOMAIN:
$!
$       RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : RUN_MCC_MAP
$!
$!  Run mcc_ac_map utility to generate MCC map file(s) and registration file(s)
$!  using data gathered by DNA4 utility.
$!
$!  Input:
$!
$!	Topology_Type : dna4_topology or ip_topology
$!
$!-----------------------------------------------------------------------------
$!
$ RUN_MCC_MAP:
$!
$	echo ""
$  	echo "        ''product_name' generating DECmcc Registration"
$	echo "        and Map files."
$   	echo ""
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$ 	THEN
$	    echo ""
$           echo "�� MCC_AC � **************** Call args to mcc_map ******************** "
$           echo "�� MCC_AC � data file ...... �''data_file'�"
$           echo "�� MCC_AC � domain ......... �''_MCC_DOMAIN'�"
$           echo "�� MCC_AC � working dir .... �''working_dir'�"
$!
	    RETURN good_status
$	ENDIF
$!
$   	mcc_map      -f  'data_file'   -
		    "-N" '_MCC_DOMAIN' -
		     -t  "''Topology_Type'"
$!
$     	IF ($STATUS .EQ. %X00000003)
$       THEN
$	    echo ""
$           echo "        Error:  Failed to generate DECmcc Registration and Map files."
$     	    GOSUB quitscript_with_bad_status
$       ELSE
$	    echo ""
$           echo "        ''product_name' finished generating DECmcc"
$	    echo "        Registration and Map files."
$     	    RETURN good_status
$       ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine: REGISTER_DOMAIN
$!
$!  Run registration scripts generated by mcc_ac_map.
$!
$!-----------------------------------------------------------------------------
$!
$ REGISTER_DOMAIN:
$!
$	echo ""
$	echo "        ''product_name' executing DECmcc Registration"
$	echo "        commands for domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$!
$  	IF F$LOGICAL("MCC_AC_UTIL_LOG") .eq. 1 THEN -
	    RETURN good_status
$!
$	IF F$SEARCH("''REGfile'") .NES. ""
$	THEN
$     	    @'REGfile'
$     	    IF $STATUS
$           THEN
$	        echo ""
$               echo "        ''product_name' finished executing DECmcc Registration commands."
$     	        RETURN good_status
$           ELSE
$	        echo ""
$               echo "        Error:  Failed to execute DECmcc Registration commands"
$		echo "                for domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$       	GOSUB quitscript_with_bad_status
$	    ENDIF
$	ELSE
$	    echo "        Error:  Command procedure ''REGfile' is missing."
$	    echo "                Unable to execute DECmcc Registration commands"
$	    echo "                for domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$           GOSUB quitscript_with_bad_status
$	ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : BUILD_ARGUMENT
$!
$!  Input:
$!
$!	Input Istr : Input string as gotten from the user
$!     	Const_Str  : A string (e.g. "-A") to embed between the white space
$!
$!  Output:
$!
$!      Ostr : Correctly formatted argument
$!
$!-----------------------------------------------------------------------------
$!
$ BUILD_ARGUMENT:
$!
$ 	Istr = f$edit(Istr, "COMPRESS, TRIM")
$ 	Sstr = Istr
$ 	done = "F"
$ 	Ostr = ""
$!
$ BEGIN_INSERTION:
$!
$ 	curr_position = F$LOCATE(" ", Sstr)
$!
$ 	IF curr_position .LT. F$LENGTH(Sstr)
$ 	THEN
$    	    Lstr = f$extract(0, curr_position, Sstr )
$    	    Rstr = f$extract( curr_position+1, F$LENGTH(Sstr), Sstr )
$    	    Ostr = Ostr + Const_Str + Lstr
$	    Sstr = Rstr
$ 	ELSE
$    	    done = "T"
$    	    Lstr = Sstr
$    	    Ostr = Ostr + Const_Str + Lstr
$ 	ENDIF
$!
$ 	IF .NOT. done THEN -
	    GOTO BEGIN_INSERTION
$!
$    	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$    	THEN
$	    echo ""
$           echo "�� MCC_AC � Input String .... � ''Istr' �"
$           echo "�� MCC_AC � Output String ... �", Ostr, " �"
$       ENDIF
$!
$ 	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : GET_TOP_DIRECTORY
$!
$!  Verify top directory, using sys$login as a default.  If sys$login
$!  is not the top directory the user wants, then ask for another.
$!
$!-----------------------------------------------------------------------------
$!
$ GET_TOP_DIRECTORY:
$!
$                     x = f$parse("sys$login") 
$       _MCC_AC_TOP_DIR = f$extract(0, f$length(x)-2, x) 
$!
$ SHOW_TOP_DIRECTORY:
$!
$	echo ""
$    	echo "        ''product_name' will use the base directory"
$	echo "        ""''_MCC_AC_TOP_DIR'""."
$	echo ""
$	ask ok "o  Is ""''_MCC_AC_TOP_DIR'"" the correct base directory? Y/N [Y]: "
$!
$	ok = F$EDIT(ok, "TRIM, UPCASE, COMPRESS")
$	IF ok .EQS. "" THEN ok = "Y"
$!
$	ok = F$EXTRACT(0, 1, ok)
$	IF ok .EQS. "Y" THEN GOTO GOT_DIRECTORY
$!
$	IF ok .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF ok .EQS. _HELP_CHAR
$	THEN
$           _HELP_TYPE = 2	! TOPDIR
$	    GOSUB print_help
$	    GOTO SHOW_TOP_DIRECTORY
$	ENDIF
$!
$ GET_DIR:
$!
$	IF ok .EQS. "N"
$	THEN
$	    echo ""
$	    ask _MCC_AC_TOP_DIR "o  Please specify a base directory: "
$	    _MCC_AC_TOP_DIR = F$EDIT(_MCC_AC_TOP_DIR, "TRIM, UPCASE, COMPRESS")
$!
$	    IF _MCC_AC_TOP_DIR .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	    IF _MCC_AC_TOP_DIR .EQS. ""
$	    THEN
$		echo ""
$		echo "        Error:  Directory specification is required."
$	        ok = "N"
$		GOTO GET_DIR
$	    ENDIF
$!
$	    IF _MCC_AC_TOP_DIR .EQS. _HELP_CHAR
$	    THEN
$               _HELP_TYPE = 2	! TOPDIR
$	        GOSUB print_help
$	        ok = "N"
$	        GOTO GET_DIR
$	    ENDIF
$!
$	    user_input = _MCC_AC_TOP_DIR  
$	    GOSUB GET_DIR_SPEC
$!
$	    IF invalid_dir .EQS. "TRUE"
$	    THEN
$	        echo ""
$		echo "        Error:  ""''_MCC_AC_TOP_DIR'"" is not a valid directory name " 
$	        ok = "N"
$		GOTO GET_DIR
$	    ELSE
$	       _MCC_AC_TOP_DIR  = dir_spec	
$	    ENDIF
$!
$	    IF F$SEARCH("''_MCC_AC_TOP_DIR'" + "*.*") .EQS. ""
$	    THEN
$	        echo ""
$		echo "        Error:  The directory you specified does not exist."
$	        ok = "N"
$		GOTO GET_DIR
$	    ENDIF
$	ENDIF
$!
$	GOTO SHOW_TOP_DIRECTORY
$!
$ GOT_DIRECTORY:
$!
$	RETURN good_status
$ !============================================================================
$ !
$ !=========================================================================================
$ !			get_dir_spec
$ !=========================================================================================
$ ! This routine will check for valid dir specification
$ ! If the specification is wrong for any reason 
$ ! the variable invalid_dir is set to "TRUE" and FALSE otherwise
$ ! If dir spec specified is okay actual directory specification
$ ! is returned in dir_spec vairable.
$ !	Input: 
$ !         user_input : the string that need to be validated 
$ !	Output:
$ !	    invalid_dir : Set to "TRUE" if invalid directory 	
$ !         		  is detected else is set to "FALSE"
$ !         dir_spec    : Is the valid dir spec. If invalid dir
$ !		          spec encountered then it is ""
$ !
$ !--------------
$  get_dir_spec:
$ !--------------
$	dir_spec = ""
$	invalid_dir = "TRUE"
$!
$ 	x = f$parse(user_input)
$ 	if x .nes. "" 
$ 	then
$          if (f$length(x)-2 .eq. f$locate(".;",x))                          
$          then                                                              
$             if ( (f$length(x)-3 .eq. f$locate("]",x))  -                    
                      .or. (f$length(x)-3 .eq. f$locate(">",x)) )             
$             then                                                            
$                 invalid_dir = "FALSE"                                   
$ 	          dir_spec = f$extract(0, f$length(x)-2, x)
$             endif                                                           
$          endif                                                             
$ 	endif
$! 
$       return
$!-----------------------------------------------------------------------------
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : SET_WORKING_DIRECTORY
$!
$!  Input :
$!
$!	_MCC_AC_TOP_DIR
$!	Topology_Type 	: dna4_topology or ip_topology
$!
$!  Set working_dir symbol, define filename symbols, and set default
$!  to working directory.
$!
$!-----------------------------------------------------------------------------
$!
$ SET_WORKING_DIRECTORY:
$!
$	IF Topology_Type .EQS. dna4_topology
$	THEN
$	    working_dir = "''_MCC_AC_TOP_DIR'" - "]" - ">" + "''dna4_dir'" + "''_MCC_DOMAIN'"
$	ELSE
$	    working_dir = "''_MCC_AC_TOP_DIR'" - "]" - ">" + "''ip_dir'" + "''_MCC_DOMAIN'"
$	ENDIF
$!
$ 	IF F$LOCATE("<", working_dir) .EQ. F$LENGTH(working_dir)
$ 	THEN
$	    working_dir = "''working_dir'" +  "]"
$ 	ELSE
$	    working_dir = "''working_dir'" +  ">"
$ 	ENDIF
$!
$  	IF F$TRNLNM("MCC_AC_UTIL_LOG") .EQS. 1
$	THEN
$	    echo ""
$           echo  "�� MCC_AC � 	working_dir...  �""''working_dir'""�"
$	ENDIF
$!
$   	data_file =  "''working_dir'" + "MCC_''_MCC_DOMAIN'" + ".CF"
$   	REGfile   =  "''working_dir'" + "MCC_''_MCC_DOMAIN'_REGISTRATION.COM"
$!
$	IF Topology_Type .EQS. ip_topology
$	THEN
$           EXfile      = "''working_dir'" + "MCC_''_MCC_DOMAIN'.EXCEPTIONS"
$           DBfile      = "''working_dir'" + "MCC_''_MCC_DOMAIN'.DBDUMP"
$           EGfile      = "''working_dir'" + "MCC_''_MCC_DOMAIN'.EDGES"
$       ELSE
$	    dna4_report_filename = "''working_dir'" + "MCC_''_MCC_DOMAIN'_SEARCH_PARAMETERS.DAT"
$	ENDIF
$!
$ 	IF F$SEARCH("''working_dir'" + "*.*") .EQS. ""
$ 	THEN
$	    echo ""
$	    create/dir/nolog 'working_dir'
$ 	ENDIF
$!
$   	set default 'working_dir'
$	echo ""
$	echo "        ''product_name' will use"
$	echo "        ""''working_dir'"" as a working"
$	echo "        directory."
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : CHECK_PREFIXES
$!
$!  Verify prefixes in MCC_AUTOCONFIG_PREFIX.DAT and if using DNS,
$!  check for presence of appropriate directories.
$!
$!-----------------------------------------------------------------------------
$!---------------
$ CHECK_PREFIXES:
$!---------------
$!
$!  By pass the check when debugging
$!
$	if f$logical("mcc_ac_util_log") .eq. 100 then goto Proper_Exit
$!
$	on_error_take_error_exit
$!
$!  Figure out if MIR or DNS
$!
$       echo ""
$	echo "        Checking the namespace.  This will take a moment.  Please wait..."
$       define/user sys$output nl:
$	manage/enter
          SHOW MCC 0          , to file SYS$SCRATCH:mcc$$_ac_NICE_REP_SELECTION1.TMP         !=>!<=  Change NICE TO IP  !=>!<=
          SHOW MCC 0 ALL CHAR , to file SYS$SCRATCH:mcc$$_ac_NICE_REP_NAME.TMP               !=>!<=  for IP script      !=>!<=
	exit
$!
$       search/out=sys$scratch:mcc$$_ac_'Topology_Type'_dNS_SELECTION2.tmp sys$scratch:mcc$$_ac_'Topology_Type'_rep_selection1.tmp  "Component Name"
$	search/out=sys$scratch:mcc$$_ac_'Topology_Type'_rep_selection2.tmp sys$scratch:mcc$$_ac_'Topology_Type'_rep_name.tmp        "Namespace Selection"
$!
$	open/read rep_data_file sys$scratch:mcc$$_ac_'Topology_Type'_rep_selection2.tmp
$	read rep_data_file REPOSITORY
$	close rep_data_file
$!
$	open/read ns_data_file sys$scratch:mcc$$_ac_'Topology_Type'_dNS_SELECTION2.tmp
$	read ns_data_file NS_SELECTION
$	close ns_data_file
$!
$	delete/noconfirm/nolog sys$scratch:mcc$$_ac_'Topology_Type'_dns_*.*;*
$	delete/noconfirm/nolog sys$scratch:mcc$$_ac_'Topology_Type'_rep_*.tmp;*
$!
$	repository = f$extract(f$locate("=",repository)+3, f$length(repository), repository)
$	repository = f$extract(0, f$length(repository)-1, repository)
$!
$	if repository .nes. "DECdns" then goto mir
$!------
$ DNS:
$!------
$!  Make sure this command procedure can run DNS$CONTROL program
$!
$	if f$search("sys$system:dns$control.exe") .eqs. "" then goto dns_no_files
$	if f$search("sys$system:dns$control.bin") .eqs. "" then goto dns_no_files
$	if f$search("sys$share:dns$lib.exe")      .eqs. "" then goto dns_no_files
$	goto dns_continue_1
$!-----------------
$ DNS_NO_FILES:
$!-----------------
$	echo ""
$       echo "        Error:  DNS$CONTROL program cannot be run on this system."
$	echo ""
$       echo "        Please make sure that following files exist:"
$	echo ""
$       echo "            SYS$SYSTEM:DNS$CONTROL.EXE - DNS control program"
$       echo "            SYS$SYSTEM:DNS$CONTROL.BIN - DNS management command parse table"
$       echo "            SYS$SHARE:DNS$LIB.EXE      - DNS shareable library"
$       echo ""
$       echo "        If you do not have access to these files, please run"
$       echo "        ''product_name' on a system which has"
$	echo "        a DNS server running."
$	goto l_nomsg_error_exit
$!-----------------
$ DNS_CONTINUE_1:
$!-----------------
$!  Determine namespace being used
$!
$	NS_SELECTION = f$extract( f$locate("=", NS_SELECTION)+2, f$length(NS_SELECTION), NS_SELECTION)
$	NS_SELECTION = f$extract(0, f$locate(":", NS_SELECTION)+1, NS_SELECTION)
$!
$!  Make sure DNS knows about the namespace
$!
$	on_error_cont
$       define/user sys$output nl:
$       define/user sys$error nl:
$       dnsctl show dir 'NS_SELECTION'.
$       o_severity = '$severity'
$	on_error_take_error_exit
$       if o_severity .ne. 1
$           then
$               echo ""
$               echo "        Error:  The ''NS_SELECTION' namespace does not exist"
$               echo "                or cannot be accessed."
$		goto l_nomsg_error_exit
$           endif
$!------
$ MIR:
$!------
$	DOMAIN_PREFIX = ""
$	NODE4_PREFIX = ""
$	SNMP_PREFIX = ""
$	NS_INIT_DOMAIN_PREFIX = 0
$	NS_INIT_NODE4_PREFIX = 0
$	NS_INIT_SNMP_PREFIX = 0
$	BAD_DOMAIN_PREFIX = 0
$	BAD_NODE4_PREFIX = 0
$	BAD_SNMP_PREFIX = 0
$!
$!  Read each prefix from the prefix file, verify the format, and
$!  check for the directory in DNS
$!
$  set_message_off
$  sear/match=and/out=sys$scratch:mcc$$_ac_'Topology_Type'_domain_prefix.tmp 'prefix_file_name' DOMAIN,   "|", ".","."
$  set_message_on
$  OPEN/READ domain_prefix_file       sys$scratch:mcc$$_ac_'Topology_Type'_domain_prefix.tmp
$  READ/End=domain_prefix_error      domain_prefix_file      domain_prefix_line
$  DOMAIN_PREFIX = F$EXTRACT(F$LOCATE("|",DOMAIN_PREFIX_LINE)+1, F$LENGTH(DOMAIN_PREFIX_LINE), DOMAIN_PREFIX_LINE)
$  DOMAIN_PREFIX = F$EDIT(domain_PREFIX, "TRIM")
$  CLOSE     domain_prefix_file
$!
$  set_message_off
$  sear/match=and/out=sys$scratch:mcc$$_ac_'Topology_Type'_node4_prefix.tmp 'prefix_file_name'  NODE4,  "|", ".","."
$  set_message_on
$  OPEN/READ node4_prefix_file       sys$scratch:mcc$$_ac_'Topology_Type'_node4_prefix.tmp
$  READ/End=node4_prefix_error       node4_prefix_file       node4_prefix_line
$  NODE4_PREFIX = F$EXTRACT(F$LOCATE("|",NODE4_PREFIX_LINE)+1, F$LENGTH(NODE4_PREFIX_LINE), NODE4_PREFIX_LINE)
$  NODE4_PREFIX = F$EDIT(node4_PREFIX, "TRIM")
$  CLOSE     node4_prefix_file
$!
$  set_message_off
$  sear/match=and/out=sys$scratch:mcc$$_ac_'Topology_Type'_snmp_prefix.tmp 'prefix_file_name'   SNMP,   "|", ".","."
$  set_message_on
$  OPEN/READ snmp_prefix_file        sys$scratch:mcc$$_ac_'Topology_Type'_snmp_prefix.tmp
$  READ/End=snmp_prefix_error             snmp_prefix_file        snmp_prefix_line
$  SNMP_PREFIX = F$EXTRACT(F$LOCATE("|",SNMP_PREFIX_LINE)+1, F$LENGTH(SNMP_PREFIX_LINE), SNMP_PREFIX_LINE)
$  SNMP_PREFIX = F$EDIT(snmp_PREFIX, "TRIM")
$  CLOSE     snmp_prefix_file
$!
$	delete/noconfirm/nolog    sys$scratch:mcc$$_ac_'Topology_Type'_*_prefix.tmp;*
$!-----------------------
$ VERIFY_PREFIX_PRESENCE:
$!-----------------------
$	IF (DOMAIN_PREFIX .EQS. "") .OR. (NODE4_PREFIX .EQS. "") .OR. (SNMP_PREFIX .EQS. "")
$	    THEN
$       	ECHO ""
$       	ECHO "        Error:  The ''general_product_name' prefix"
$	        ECHO "                file has not been set up properly."
$       	ECHO ""
$       	ECHO "        Prefixes for the following entity classes are not specified:"
$       	ECHO ""
$       	IF (DOMAIN_PREFIX .EQS. "") THEN ECHO "   DOMAIN"
$       	IF (NODE4_PREFIX .EQS. "") THEN ECHO "   NODE4"
$       	IF (SNMP_PREFIX .EQS. "") THEN ECHO "   SNMP"
$       	ECHO ""
$		ECHO "        Please edit the ''general_product_name' prefix"
$		ECHO "        file ''prefix_file_name' and"
$		ECHO "        rerun ''product_name'."
$		goto l_nomsg_error_exit
$	    ENDIF
$!---------------------
$ VERIFY_PREFIX_FORMAT:
$!---------------------
$!  			Verify that prefixes begin and end with "."
$!
$       dot = f$extract(f$length(domain_prefix)-1, 1, domain_prefix)
$       if (dot .nes. ".") then bad_domain_prefix = 1
$       dot = f$extract(f$length(node4_prefix)-1, 1, node4_prefix)
$       if (dot .nes. ".") then bad_node4_prefix = 1
$       dot = f$extract(f$length(snmp_prefix)-1, 1, snmp_prefix)
$       if (dot .nes. ".") then bad_snmp_prefix = 1
$!
$       dot = f$extract(0, 1, domain_prefix)
$       if (dot .nes. ".") then bad_domain_prefix = 1
$       dot = f$extract(0, 1, node4_prefix)
$       if (dot .nes. ".") then bad_node4_prefix = 1
$       dot = f$extract(0, 1, snmp_prefix)
$       if (dot .nes. ".") then bad_snmp_prefix = 1
$!
$	if (bad_domain_prefix .eq. 1) .or. (bad_node4_prefix .eq. 1) .or. (bad_snmp_prefix .eq. 1)
$	    then
$       	ECHO ""
$       	ECHO "        Error:  The ''general_product_name' prefix"
$	        ECHO "                file has not been set up properly."
$       	ECHO ""
$       	echo "        The following prefixes are invalid:"
$       	echo ""
$       	if (bad_domain_prefix .eq. 1) then echo "   ''domain_prefix'"
$       	if (bad_node4_prefix  .eq. 1) then echo "   ''node4_prefix'"
$       	if (bad_snmp_prefix   .eq. 1) then echo "   ''snmp_prefix'"
$       	echo ""
$		echo "        All prefixes must end with a ""."""
$       	echo ""
$       	ECHO ""
$		ECHO "        Please edit the ''general_product_name' prefix"
$		ECHO "        file ''prefix_file_name' and"
$		ECHO "        rerun ''product_name'."
$		goto l_nomsg_error_exit
$	    endif
$!
$!  Check for the directory in DNS
$!
$!--------------------
$ VERIFY_PREFIX_DIR:
$!--------------------
$	if repository .nes. "DECdns" then goto get_user_ok
$!
$	on_error_cont
$       	define/user sys$output nl:
$       	define/user sys$error nl:
$       	dnsctl show dir 'NS_SELECTION''domain_prefix'
$       	ns_init_domain_prefix = '$severity'
$	on_error_take_error_exit
$!
$	on_error_cont
$       	define/user sys$output nl:
$       	define/user sys$error nl:
$       	dnsctl show dir 'NS_SELECTION''node4_prefix'
$       	ns_init_node4_prefix = '$severity'
$	on_error_take_error_exit
$!
$	on_error_cont
$       	define/user sys$output nl:
$       	define/user sys$error nl:
$       	dnsctl show dir 'NS_SELECTION''snmp_prefix'
$       	ns_init_snmp_prefix = '$severity'
$	on_error_take_error_exit
$!
$	if (ns_init_domain_prefix .eq. 1) .and. (ns_init_node4_prefix .eq. 1) -
           .and. (ns_init_snmp_prefix .eq. 1) then goto get_user_ok
$!
$       echo ""
$       echo "        Error:  The ''general_product_name' prefix"
$	echo "                file has not been set up properly."
$       echo ""
$       echo "        The following directories have been specified"
$	echo "        in the prefix file but do not exist in ''NS_SELECTION':"
$       echo ""
$       if (ns_init_domain_prefix .ne. 1) then echo "           ''NS_SELECTION'''domain_prefix'"
$       if (ns_init_node4_prefix .ne. 1) then echo  "           ''NS_SELECTION'''node4_prefix'"
$       if (ns_init_snmp_prefix .ne. 1) then echo   "           ''NS_SELECTION'''snmp_prefix'"
$       echo ""
$	echo "        You may either create the above directories"
$	echo "        in ''NS_SELECTION' or edit the"
$	echo "        ''general_product_name' prefix file"
$	echo "        ''prefix_file_name' to match existing"
$	echo "        directories in ''NS_SELECTION'."
$!
$	goto l_nomsg_Error_exit
$!
$!--------------------
$ GET_USER_OK:
$!--------------------
$! Make sure the user wants to use the prefixes we found
$!
$	echo ""
$       echo "        ''product_name' will use the following prefixes"
$       echo "        to generate fullnames for registration:"
$       echo ""
$       echo "            Entity Class  Prefix"
$       echo ""
$       echo "            DOMAIN        ''DOMAIN_PREFIX'"
$       echo "            NODE4         ''NODE4_PREFIX'"
$       echo "            SNMP          ''SNMP_PREFIX'"
$       echo ""
$       ask answer "o  Are the above prefixes ok? Y/N [Y]: "
$	answer = f$edit(answer, "upcase,trim,collapse")
$	if (answer .eqs. "") then answer = "Y"
$	answer = F$EXTRACT(0, 1, answer)
$	if (answer .eqs. "Y") then goto proper_exit
$	if answer .eqs. _help_char
$	then
$	    _help_type = 6	! NAMESPACE
$	    GOSUB print_help
$	endif
$	if answer .eqs. _help_char then goto get_user_ok
$	if answer .eqs. "Q" then GOSUB quitscript_with_good_status
$	if answer .nes. "Y"
$	then
$           echo ""
$	    echo "        Please edit the ''general_product_name' prefix"
$	    echo "        file ''prefix_file_name' and"
$	    echo "        rerun ''product_name'."
$	    goto l_nomsg_Error_exit
$	endif
$!
$!--------------------
$ Proper_Exit:
$!--------------------
$!
$      if f$logical("mcc_ac_util_log") .eq. 100
$      then
$	   _MCC_DOMAIN_PREFIX = ".domain."
$	   _MCC_NODE4_PREFIX  = ".DNA_node."
$	   _MCC_SNMP_PREFIX   = ".ip."
$	else
$          _MCC_DOMAIN_PREFIX = DOMAIN_PREFIX
$          _MCC_NODE4_PREFIX  = NODE4_PREFIX
$          _MCC_SNMP_PREFIX   = SNMP_PREFIX
$	endif
$
$	RETURN good_status
$!
$!  Some error occured during processing.
$!
$!--------------------
$ l_nomsg_Error_exit:
$!--------------------
$ 	set_message_off
$	close rep_data_file
$	close ns_data_file
$	delete/noconfirm/nolog sys$scratch:mcc$$_ac_'Topology_Type'_dns_*.*;*
$	delete/noconfirm/nolog sys$scratch:mcc$$_ac_'Topology_Type'_rep_*.tmp;*
$ 	set_message_on
$       goto no_msg_error_exit
$!
$!--------------------
$ SNMP_prefix_error:
$!--------------------
$	echo ""
$       echo "        Error:  SNMP prefix information is required in"
$	echo "                the ''general_product_name' prefix file
$	echo "                ''prefix_file_name'."
$       goto no_msg_error_exit
$!--------------------
$ NODE4_prefix_error:
$!--------------------
$	echo ""
$       echo "        Error:  NODE4 prefix information is required in"
$	echo "                the ''general_product_name' prefix file
$	echo "                ''prefix_file_name'."
$       goto no_msg_error_exit
$!--------------------
$ domain_prefix_error:
$!--------------------
$	echo ""
$       echo "        Error:  DOMAIN prefix information is required in"
$	echo "                the ''general_product_name' prefix file
$	echo "                ''prefix_file_name'."
$       goto no_msg_error_exit
$!
$!-----------------------------------------------------------------------------
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : ASK_COPY_MAP_FILES
$!
$!  Confirm with user that map files should be copied to MCC_MAP.
$!
$!  Output : _COPY_MAP_FILES
$!		If 1, then files will be copied.  Else 0.
$! 	     _MAP_FILE_DESTINATION
$!		Directory to which map files should be copied.
$!
$!  13-MAY-1992 UF	Modified text of question about whether okay to
$!			copy files (on advice of tech writer).
$!-----------------------------------------------------------------------------
$!--------------------
$ ask_copy_map_files:
$!--------------------
$	_copy_map_files = 1
$	_copy_map_files_syslogin = 0
$!----------
$ ask_copy:
$!----------
$       x = f$parse("mcc_maps") 
$       _map_file_destination = f$extract(0, f$length(x)-2, x) 
$	if (_map_file_destination .eqs. "") 
$	then
$           x = f$parse("sys$login") 
$           _map_file_destination = f$extract(0, f$length(x)-2, x) 
$	    _copy_map_files_syslogin = 1
$	endif
$!
$ ASK_COPY2:
$!
$	echo ""
$	if _copy_map_files_syslogin .eq. 1
$	then
$	    echo "        The logical MCC_MAPS is not defined.  Therefore,"
$	    echo "        ''product_name' will copy DECmcc Map files to"
$	    echo "        your login directory, ""''_MAP_FILE_DESTINATION'""."
$	else
$	    echo "        ''product_name' will copy DECmcc Map"
$           echo "        files to MCC_MAPS, which is currently pointing"
$	    echo "        to the directory ""''_MAP_FILE_DESTINATION'""."
$	endif
$	echo ""
$	echo "o  Type N to prevent copying DECmcc Map files to"
$	ask ok "   ""''_MAP_FILE_DESTINATION'"". Y/N [Y]: "
$!
$	ok = f$edit(OK, "trim, upcase, compress")
$	if OK .eqs. "" then OK = "Y"
$!
$	OK = f$extract(0, 1, OK)
$	if OK .eqs. "Y" then goto c_done
$!
$	if OK .eqs. "Q" then gosub QUITSCRIPT_WITH_GOOD_STATUS
$!
$	if OK .eqs. _help_char
$	then
$           _help_type = 3      ! COPYFILES
$	    GOSUB print_help
$	    goto ask_copy
$	endif
$!
$	if ok .eqs. "N"
$	then
$	    _copy_map_files = 0
$	else
$	    goto ask_copy2
$	endif
$!
$ c_done:
$!
$	return GOOD_STATUS
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : COPY_MAP_FILES
$!
$!  Copy map files using command procedure, if _COPY_MAP_FILES = 1.
$!  If files are copied, then tell the user they can use them,
$!  either for opening the domain or map snapshots, depending on
$!  the value of _AUTOCONFIG_OPTION.
$!
$!  Input :
$!
$!	_MCC_DOMAIN
$!	_MCC_DOMAIN_PREFIX
$!	_AUTOCONFIG_OPTION
$!
$!  Output :
$!
$!	_COPY_MAP_FILES
$!	    If 1, then files will be copied.  Else 0.
$!
$! 	_MAP_FILE_DESTINATION
$!	    Directory to which map files should be copied.
$!
$! 15-MAY-1992	UF	Reflect the switch of options 1 and 2 in the message
$!			about displaying maps.
$!
$!-----------------------------------------------------------------------------
$!
$ COPY_MAP_FILES:
$!
$!
$	_MAP_FILES_COPIED = 0
$!
$	COPY_PROCEDURE = "MCC_''_MCC_DOMAIN'_COPY_MAPS.COM"
$!
$	IF _COPY_MAP_FILES .EQ. 1
$	THEN
$	    IF F$SEARCH("''copy_procedure'") .NES. ""
$	    THEN
$	        @'copy_procedure' "''_MAP_FILE_DESTINATION'"
$	        echo ""
$		echo "        DECmcc Map files copied to ""''_MAP_FILE_DESTINATION'""."
$	        _MAP_FILES_COPIED = 1
$	    ELSE
$	  	echo ""
$	 	echo "        Error:  Command procedure ''copy_procedure' is missing."
$		echo "                DECmcc Map files will not be copied."
$	    ENDIF
$	ENDIF
$!
$!  Tell the user they can use the maps now.
$!
$ 	IF _MAP_FILES_COPIED .EQ. 1
$	THEN
$	    IF _AUTOCONFIG_OPTION .EQS. "2" .OR. -
 	       _AUTOCONFIG_OPTION .EQS. "4"
$	    THEN
$	        echo ""
$               echo "        You may now open domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$	    ENDIF
$!
$	    IF _AUTOCONFIG_OPTION .EQS. "1" .OR. -
 	       _AUTOCONFIG_OPTION .EQS. "3"
$	    THEN
$		echo ""
$	        echo "        You may now view DECmcc Maps for domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'"""
$	        echo "        using the ""DECmcc Map Snapshots"" option."
$	    ENDIF
$	ENDIF
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : DELETE_FILES
$!
$!  Delete files created by Autoconfiguration which are no longer needed.
$!
$!  Input:
$!
$!	Topology_Type : dna4_topology or ip_topology
$!
$!  13-May-1992 	UF	Modified to purge .cf* files for DNA4,
$!				not delete them.
$!  15-May-1992		UF	Removed version specs from PURGE statements.
$!-----------------------------------------------------------------------------
$!
$ DELETE_FILES:
$!
$	DELETE = "DELETE"
$!
$	IF Topology_Type .EQS. dna4_topology
$	THEN
$	    IF F$SEARCH("*.cf1;*") .NES. "" THEN PURGE/NOLOG/KEEP=3 *.cf1
$	    IF F$SEARCH("*.cf2;*") .NES. "" THEN PURGE/NOLOG/KEEP=3 *.cf2
$	    IF F$SEARCH("*.cf_exceptions;*") .NES. "" THEN PURGE/NOLOG/KEEP=3 *.cf_exceptions
$	ELSE
$	    IF F$SEARCH("*.dbdump;*") .NES. "" THEN DELETE/NOLOG *.dbdump;*
$	    IF F$SEARCH("*.edges;*") .NES. "" THEN DELETE/NOLOG *.edges;*
$	    IF F$SEARCH("*.exceptions;*") .NES. "" THEN DELETE/NOLOG *.exceptions;*
$	ENDIF
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : FILES_CREATED
$!
$!  List files created by Autoconfiguration since _START_TIME.
$!
$!  Inputs:
$!
$!	_START_TIME (Time this procedure started)
$!
$! 15-May-1992	UF	Fixed bug in f$search statement.
$!
$!-----------------------------------------------------------------------------
$!
$ FILES_CREATED:
$!
$	DIRECTORY = "DIRECTORY"
$!
$ 	IF F$SEARCH("''working_dir'" + "*.*") .NES. ""
$	THEN
$	    echo ""
$	    echo "        The following files were created by this"
$	    echo "        ''product_name' run:"
$	    echo ""
$	    DIRECTORY/DATE/SIZE/SINCE="''_START_TIME'" 'working_dir'
$	ELSE
$	    echo ""
$	    echo "        No files were created by this ''product_name' run."
$	ENDIF
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : GET_AUTOCONFIG_OPTION
$!
$!  Ask user what they want to do.
$!
$!  Output:  _AUTOCONFIG_OPTION = "1", "2", "3", or "4"
$!
$!-----------------------------------------------------------------------------
$!
$ GET_AUTOCONFIG_OPTION:
$!
$	_PRINT_STAR = 0
$!
$	_REG_ONLY = 0
$	IF F$SEARCH("MCC_''_MCC_DOMAIN'_REGISTRATION.COM") .NES. "" THEN -
		_REG_ONLY = 1
$!
$	_CREATE_MAP_FILES = 0
$	IF ((F$SEARCH("MCC_''_MCC_DOMAIN'.CFA") .NES "") .AND. -
	    (F$SEARCH("MCC_''_MCC_DOMAIN'.CFB") .NES "") .AND. -
	    (F$SEARCH("MCC_''_MCC_DOMAIN'.CFC") .NES "")) THEN -
		_CREATE_MAP_FILES = 1
$!
$ GET_OPTION:
$!
$	echo ""
$	echo "        Please choose one of the following"
$	echo "        ''product_name' options:"
$	echo ""
$	echo "        [1] Discovery"
$	echo "        [2] Discovery and Registration"
$	IF _CREATE_MAP_FILES
$	THEN
$	    echo "        [3] Creation of Map and Registration Files"
$	ELSE
$	    _PRINT_STAR = 1
$	    echo "      * [3] Creation of Map and Registration Files"
$	ENDIF
$	IF _REG_ONLY
$	THEN
$	    echo "        [4] Registration"
$	ELSE
$	    _PRINT_STAR = 1
$	    echo "      * [4] Registration"
$ 	ENDIF
$	echo ""
$	echo "        Note that it is possible to view DECmcc Maps before running"
$	echo "        registration, using the ""DECmcc Map Snapshots"" option."
$	echo "        If you wish to do this, choose option [1]."
$	echo ""
$	IF (_PRINT_STAR)
$	THEN
$	    echo "        * These options are disabled until supporting files"
$	    echo "          are created by choosing option [1] or [2]."
$	    echo ""
$	ENDIF
$!
$	ask _AUTOCONFIG_OPTION "o  Enter option [2]: "
$!
$	_AUTOCONFIG_OPTION = F$EDIT(_AUTOCONFIG_OPTION, "TRIM, UPCASE, COMPRESS")
$	IF _AUTOCONFIG_OPTION .EQS. "" THEN _AUTOCONFIG_OPTION = "2"
$!
$	_AUTOCONFIG_OPTION = F$EXTRACT(0, 1, _AUTOCONFIG_OPTION)
$!
$	IF _AUTOCONFIG_OPTION .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF _AUTOCONFIG_OPTION .EQS. _HELP_CHAR
$	THEN
$           _HELP_TYPE = 4      ! AUTO_OPTION
$	    GOSUB print_help
$	    GOTO GET_OPTION
$	ENDIF
$!
$	_CHOICE_LIST = "1/2"
$	IF _REG_ONLY THEN _CHOICE_LIST = _CHOICE_LIST + "/3"
$	IF _CREATE_MAP_FILES THEN _CHOICE_LIST = _CHOICE_LIST + "/4"
$!
$	I = 0
$!
$ CHECK_AUTO_OPTION:
$!
$	LABEL = F$ELEMENT(I, "/", _CHOICE_LIST)
$	IF LABEL .EQS. "/" THEN GOTO BAD_AUTO_OPTION
$	IF _AUTOCONFIG_OPTION .EQS. LABEL THEN GOTO CHOICE_MADE
$	I = I + 1
$	GOTO CHECK_AUTO_OPTION
$!
$ BAD_AUTO_OPTION:
$!
$	GOTO GET_OPTION
$!
$ CHOICE_MADE:
$!
$	IF _AUTOCONFIG_OPTION .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : DO_AUTOCONFIG
$!
$!  Perfom autoconfig action chosen by user, depending on topology_type.
$!
$!  Input:
$!
$!	_AUTOCONFIG_OPTION ("1", "2", "3", or "4")
$!	Topology_Type : dna4_topology or ip_topology
$!
$!  13-MAY-1992 	UF	Modified to call copy_map_files after
$!				run_mcc_map.
$!-----------------------------------------------------------------------------
$!
$ DO_AUTOCONFIG:
$!
$	IF _AUTOCONFIG_OPTION .EQS. "1" .OR. -
 	   _AUTOCONFIG_OPTION .EQS. "2"
$	THEN
$	    GOSUB do_autoconfig_discovery
$	ENDIF
$!
$	IF _AUTOCONFIG_OPTION .EQS. "1" .OR. -
	   _AUTOCONFIG_OPTION .EQS. "2" .OR. -
 	   _AUTOCONFIG_OPTION .EQS. "3"
$	THEN
$	    GOSUB run_mcc_map
$	    GOSUB copy_map_files
$	ENDIF
$!
$	IF _AUTOCONFIG_OPTION .EQS. "2" .OR. -
 	   _AUTOCONFIG_OPTION .EQS. "4"
$	THEN
$	    GOSUB register_domain
$	ENDIF
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : DO_AUTOCONFIG_DISCOVERY
$!
$!  Perfom autoconfig discovery, depending on topology_type.
$!
$!  Input:
$!
$!	Topology_Type : dna4_topology or ip_topology
$!
$!-----------------------------------------------------------------------------
$!
$ DO_AUTOCONFIG_DISCOVERY:
$!
$	IF Topology_Type .EQS. dna4_topology
$	THEN
$	    GOSUB get_dna4_criteria
$!
$	    GOSUB run_dna4_collector
$!
$	    GOSUB run_dna4_mapper
$	ELSE
$	    GOSUB get_ip_criteria
$!
$	    GOSUB run_snmpmap
$	ENDIF
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  GET_IP_CRITERIA
$!
$!  Get IP collection criteria from the user
$!
$!-----------------------------------------------------------------------------
$!
$ GET_IP_CRITERIA:
$!
$!=============================================================================
$!
$!  Generate the initial configuration file if it does not already exist.
$!
$!=============================================================================
$!
$    	foo = f$search("''data_file'")
$    	if (FOO .eqs. "")
$    	then
$           gosub ip_make_config
$	    if $status
$	    then
$	        gosub edit_IP_cf_file
$    	    endif
$       else
$	    gosub handle_IP_ans
$       endif
$!
$	RETURN
$!============================================================================
$!---------------
$ handle_IP_ans:
$!---------------
$
$	echo ""
$	echo "        You already have a configuration file in your working directory.
$!----------------
$ handle_IP_ans_0:
$!----------------
$	echo ""
$       echo "        Do you wish to:"
$!-----------------
$ handle_IP_ans_1:
$!-----------------
$       echo ""
$       echo "        [1] Build a new default configuration file."
$       echo "        [2] Edit the existing configuration file."
$       echo "        [3] Run the ''product_name' utility."
$	echo ""
$	ask ans " o Enter option [2] : "
$!
$       ans = F$EDIT(ans,"UPCASE,TRIM,COMPRESS")
$	if ans .eqs. "" then ans = "2"
$	ans = F$EXTRACT(0, 1, ans)
$       ans_choice = "1/2/3/Q/''_help_char'"
$       i = 0
$!----------------------
$ l_check_menu_choice:
$!----------------------
$!
$       label = f$element(i, "/", ans_choice)
$    	if label .eqs. "/" then goto l_bad_menu_choice
$    	if ans .eqs. _help_char then goto IP_choice_help
$    	if ans .eqs. label  then goto IP_choice_'label'
$    	i = i + 1
$!
$    	goto l_check_menu_choice
$!--------------------
$ l_bad_menu_choice:
$!--------------------
$	echo ""
$    	echo "        Please choose one of the following:"
$    	GOTO handle_IP_ans_1
$!------------
$ IP_choice_1:
$!------------
$   	gosub ip_make_config
$   	if $status
$   	then
$     	    gosub edit_IP_cf_file
$   	endif
$   	goto handle_IP_ans_0
$!
$!------------
$ IP_choice_2:
$!------------
$   	gosub edit_IP_cf_file
$   	goto handle_IP_ans_0
$!
$!------------
$ IP_choice_3:
$!------------
$   	goto l_GET_IP_CRITERIA_done
$!
$!------------
$ IP_choice_Q:
$!------------
$   	GOSUB quitscript_with_good_status
$!
$!---------------
$ IP_choice_help:
$!---------------
$!
$   	_help_type = 7	! IP_CHOICE
$   	GOSUB print_help
$   	goto handle_IP_ans_0
$
$!-----------------------
$ l_GET_IP_CRITERIA_done:
$!-----------------------
$	RETURN
$!
$!-----------------
$ edit_IP_cf_file:
$!-----------------
$!
$    	define/nolog/user sys$input sys$command:
$    	edit = "edit"
$    	edit/edt/nojournal/command='EDTcommands' 'data_file'
$!
$	return GOOD_STATUS
$!
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  GET_DNA4_CRITERIA
$!
$!  Get DNA4 collection criteria from the user
$!
$!  13-MAY-1992	UF	Commented out calls to dna4_backbone().  Option
$!			no longer supported.  Orientation is always horizontal.
$!-----------------------------------------------------------------------------
$!
$ GET_DNA4_CRITERIA:
$!
$	echo ""
$	echo "        Please choose one of the following configurations:"
$       echo  ""
$	echo "        [1] All DECnet Phase IV nodes"
$	echo "        [2] All DECnet Phase IV nodes in selected area(s)"
$	echo "        [3] All DECnet Phase IV nodes in a LAN"
$	echo ""
$	echo "        [4] All level 1 and level 2 DECnet Phase IV routers"
$	echo "        [5] ALL level 1 and level 2 DECnet Phase IV routers in selected area(s)"
$	echo "        [6] ALL level 1 and level 2 DECnet Phase IV routers on the LAN"
$	echo ""
$	echo "        [7] All level 2 DECnet Phase IV routers"
$	echo "        [8] All level 2 DECnet Phase IV routers in selected area(s)"
$	echo "        [9] All level 2 DECnet Phase IV routers in the LAN"
$	echo ""
$!
$	ask _DNA4_CONFIG "o  Enter option [2]: "
$!
$	_DNA4_CONFIG = F$EDIT(_DNA4_CONFIG, "TRIM, UPCASE, COMPRESS")
$	IF _DNA4_CONFIG .EQS. "" THEN _DNA4_CONFIG = "2"
$!
$	_DNA4_CONFIG = F$EXTRACT(0, 1, _DNA4_CONFIG)
$!
$	IF _DNA4_CONFIG .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF _DNA4_CONFIG .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 9	! DNA4_CONFIG
$	    GOSUB print_help
$	    GOTO GET_DNA4_CRITERIA
$	ENDIF
$!
$ 	DNA4_CONFIG_LIST = "1/2/3/4/5/6/7/8/9"
$       I = 0
$!
$ CHECK_DNA4_CONFIG_CHOICE:
$!
$	LABEL = F$ELEMENT(I, "/", DNA4_CONFIG_LIST)
$	IF LABEL .EQS. "/" THEN GOTO GET_DNA4_CRITERIA
$	IF _DNA4_CONFIG .EQS. LABEL THEN GOTO DNA4_CHOICE_MADE
$	I = I + 1
$	GOTO CHECK_DNA4_CONFIG_CHOICE
$!
$ DNA4_CHOICE_MADE:
$!
$	GOTO DNA4_L'_DNA4_CONFIG'
$!
$ DNA4_L1:
$!
$    	SW_T = """-T"" 1"
$    	SW_L = """-L"" 1"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L2:
$!
$    	SW_T  = """-T"" 1"
$    	SW_L  = """-L"" 2"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_search_type
$	GOSUB dna4_get_seed_node_list
$    	GOSUB dna4_get_area_list
$    	GOSUB dna4_get_excl_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L3:
$!
$    	SW_T  = """-T"" 1"
$    	SW_L  = """-L"" 3"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L4:
$!
$    	SW_T  = """-T"" 2"
$    	SW_L  = """-L"" 1"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L5:
$!
$    	SW_T  = """-T"" 2"
$    	SW_L  = """-L"" 2"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_search_type
$    	GOSUB dna4_get_seed_node_list
$    	GOSUB dna4_get_area_list
$    	GOSUB dna4_get_excl_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L6:
$!
$    	SW_T  = """-T"" 2"
$    	SW_L  = """-L"" 3"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L7:
$!
$    	SW_T  = """-T"" 3"
$    	SW_L  = """-L"" 1"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L8:
$!
$    	SW_T  = """-T"" 3"
$    	SW_L  = """-L"" 2"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_search_type
$	GOSUB dna4_get_seed_node_list
$    	GOSUB dna4_get_area_list
$    	GOSUB dna4_get_excl_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L9:
$!
$    	SW_T  = """-T"" 3"
$    	SW_L  = """-L"" 3"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ GOT_DNA4_CRITERIA:
$!
$	GOSUB PRINT_DNA4_CRITERIA_REPORT
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_NODE_INFO
$!
$!  Get DNA4 node information
$!
$!  Outputs:
$!
$!	seed_node
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_NODE_INFO:
$!
$	mcr ncp show exec to sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp1.tmp
$       search/out=sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp2.tmp sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp1.tmp	"Executor node"
$!
$ 	open/read/ERROR=GET_NODE_ERROR dat_file sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp2.tmp
$ 	read/END_OF_FILE=GET_NODE_ERROR dat_file n_add
$       close dat_file
$	IF F$SEARCH("sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp%.tmp;*") .NES. "" THEN -
            delete/noconf/nolog sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp%.tmp;*
$!
$       n_add = f$extract(f$locate("=", n_add) + 2,f$length(n_add),n_add)
$       n_add = f$extract(0, f$locate("(",n_add)-1,n_add)
$       area_number = f$extract(0, f$locate(".",n_add), n_add)
$       node_number = f$extract(f$locate(".",n_add)+1,f$length(n_add) - f$locate(".",n_add), n_add)
$!
$	seed_node = seed_node_default_string + n_add
$!	seed_node_list = seed_node
$!
$	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$ 	THEN
$	    echo ""
$           echo "�� MCC_AC � seed_node is: ", seed_node
$           echo "�� MCC_AC � node_number is: ''node_number'"
$           echo "�� MCC_AC � area_number is: ''area_number'"
$ 	ENDIF
$!
$	RETURN good_status
$!
$ GET_NODE_ERROR:
$!
$	echo ""
$	echo "        Error: Error determining default starting node."
$       close dat_file
$	IF F$SEARCH("sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp%.tmp;*") .NES. "" THEN -
            delete/noconf/nolog sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp%.tmp;*
$	GOSUB quitscript_with_bad_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_SEED_NODE_LIST
$!
$!  Get DNA4 seed node information
$!
$!  Outputs:
$!
$!	seed_node_list
$!	report_seed_node_list
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_SEED_NODE_LIST:
$!
$!  Bypass this question if the search is done by address!
$!
$  	if query_all .eqs. "-q " then goto done_seed_node_list
$!
$    	seed_node_list = seed_node
$    	count = 0
$    	use_default = "F"
$!
$	echo ""
$	echo    "         Please specify starting nodes for the search."
$	echo    "         Enter one node at a time."
$	echo ""
$       ask tmp "o  Starting node [''seed_node_list']: "
$!
$	tmp = F$EDIT(tmp, "TRIM, UPCASE, COMPRESS")
$       IF tmp .EQS. "Q" THEN GOSUB quitscript_with_good_status
$	IF tmp .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 11	! SEED_NODE
$	    GOSUB print_help
$	    GOTO DNA4_GET_SEED_NODE_LIST
$	ENDIF
$!
$!----------------------------
$ get_more_seed_node_list:
$!----------------------------
$!
$    	if (tmp .nes. "Q")         ! <=
$    	then
$           if (count .eq. 0) .and. (tmp .eqs. "")
$           then
$	        echo ""
$		echo    "        Press RETURN to end the list."
$	   	echo ""
$          	ask tmp "o  Additional starting node(s) [''seed_node_list']: "
$!
$		tmp = F$EDIT(tmp, "TRIM, UPCASE, COMPRESS")
$       	IF tmp .EQS. "Q" THEN GOSUB quitscript_with_good_status
$		IF tmp .EQS. _HELP_CHAR
$		THEN
$	    	    _HELP_TYPE = 11	! SEED_NODE
$	    	    GOSUB print_help
$	    	    GOTO GET_MORE_SEED_NODE_LIST
$		ENDIF
$!
$		IF tmp .NES. _HELP_CHAR THEN -
          	    seed_node_list = seed_node_list + " " +  tmp
$	   	if tmp .eqs. "" then use_default = "T"
$          	tmp = seed_node_list
$           else
$          	if (count .eq. 1) .and. (tmp .nes. "")
$          	then
$		    IF tmp .NES. _HELP_CHAR THEN -
 	                seed_node_list = tmp
$	      	    echo ""
$             	    echo    "        Press RETURN to end the list."
$	      	    echo ""
$                   ask tmp "o  Additional starting node(s) [''seed_node_list']: "
$!
$		    tmp = F$EDIT(tmp, "TRIM, UPCASE, COMPRESS")
$       	    IF tmp .EQS. "Q" THEN GOSUB quitscript_with_good_status
$		    IF tmp .EQS. _HELP_CHAR
$		    THEN
$	    	        _HELP_TYPE = 11	! SEED_NODE
$	    	        GOSUB print_help
$	    	        GOTO GET_MORE_SEED_NODE_LIST
$		    ENDIF
$!
$	        else
$                   if (count .gt. 1) .and. (tmp .nes. "")
$                   then
$		        IF tmp .NES. _HELP_CHAR THEN -
 			    seed_node_list = seed_node_list + " " +  tmp
$	           	echo ""
$                  	echo    "        Press RETURN to end the list."
$	           	echo ""
$       	   	ask tmp "o  Additional starting node(s) [''seed_node_list']: "
$!
$		        tmp = F$EDIT(tmp, "TRIM, UPCASE, COMPRESS")
$       	        IF tmp .EQS. "Q" THEN GOSUB quitscript_with_good_status
$		        IF tmp .EQS. _HELP_CHAR
$		        THEN
$	    	            _HELP_TYPE = 11	! SEED_NODE
$	    	            GOSUB print_help
$	    	            GOTO GET_MORE_SEED_NODE_LIST
$		        ENDIF
$!
$              	    endif
$               endif
$           endif
$    	endif
$!
$	if use_default .eqs. "T" then goto done_seed_node_list
$      	if (tmp .eqs. "") .and. (count .gt. 0) then goto done_seed_node_list
$!
$      	if tmp .eqs. "Q" then gosub quitscript_with_good_status
$!
$       count = count + 1
$ 	goto get_more_seed_node_list
$!
$!---------------------
$  done_seed_node_list:
$!---------------------
$       count = 0
$!
$	report_seed_node_list = seed_node_list
$!
$ 	if f$logical("mcc_ac_util_log") .eq. 1
$ 	then
$           echo "�� MCC_AC � Seed list is �''seed_node_list'�"
$ 	endif
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_AREA_LIST
$!
$!  Get DNA4 area list
$!
$!  Outputs:
$!
$!  	area_include
$!	report_area_include
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_AREA_LIST:
$!
$	incl_area_list = area_number
$	count = 0
$!
$	echo ""
$	echo "        Please specify areas to include in the search."
$	echo ""
$	echo "        Enter one area at a time."
$!
$ DNA4_GET_AREA_LIST2:
$!
$	echo ""
$	ask tmp_area "o  Area to include [''incl_area_list']: "
$!
$ CHECK_AREA_ENTRY:
$!
$	tmp_area = F$EDIT(tmp_area, "TRIM, UPCASE, COMPRESS")
$!
$	tmp_area_option = F$EXTRACT(0, 1, tmp_area)
$!
$	IF tmp_area_option .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF tmp_area_option .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 12 	! AREA_INCLUDE
$	    GOSUB print_help
$	    IF (count .EQ. 0)
$	    THEN
$	        GOTO DNA4_GET_AREA_LIST
$	    ELSE
$		GOTO GET_ADDITIONAL_AREA
$	    ENDIF
$	ENDIF
$!
$	integer_area = F$INTEGER(tmp_area)
$	IF integer_area .GT. 63
$	THEN
$	    echo ""
$	    echo "        Error:  Area must be 63 or less."
$	    IF (count .EQ. 0)
$	    THEN
$	        GOTO DNA4_GET_AREA_LIST
$	    ELSE
$		GOTO GET_ADDITIONAL_AREA
$	    ENDIF
$	ENDIF
$!
$	IF (count .EQ. 0) 
$	THEN
$           IF (tmp_area .NES. "") THEN incl_area_list = tmp_area
$	ELSE
$	    IF (tmp_area .EQS. "")
$	    THEN
$		GOTO DONE_GET_AREA_LIST
$	    ELSE
$               incl_area_list = incl_area_list + " " + tmp_area
$	    ENDIF
$	ENDIF
$!
$ GET_ADDITIONAL_AREA:
$!
$       echo ""
$       echo         "        Press RETURN to end the list."
$       echo ""
$	ask tmp_area "o  Additional area to include [''incl_area_list']: "
$!
$     	count = count + 1
$!
$     	GOTO CHECK_AREA_ENTRY
$!
$ DONE_GET_AREA_LIST:
$!
$	report_area_include = incl_area_list
$!
$	const_str = " ""-A"" "
$	Istr = incl_area_list
$	GOSUB build_argument
$	area_include = Ostr
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$	THEN
$	    echo ""
$	    echo "�� MCC_AC � Area include list is � ", incl_area_list, " �"
$	    echo "�� MCC_AC � Areas to include � ", area_include, " �"
$	ENDIF
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_SEARCH_TYPE
$!
$!  Get DNA4 search type
$!
$!  Outputs:
$!
$!	guery_all
$!	report_search
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_SEARCH_TYPE:
$!
$	search_method  = 1
$!
$	echo ""
$	echo "        Please choose a search method:"
$	echo ""
$       echo "        [1] Search by adjacency"
$       echo "        [2] Search by address"
$	echo ""
$!
$	ask search_method "o  Enter option [1]: "
$!
$	search_method = F$EDIT(search_method, "TRIM, UPCASE, COMPRESS")
$	IF search_method .EQS. "" THEN search_method = 1
$!
$	search_method = F$EXTRACT(0, 1, search_method)
$!
$	IF search_method .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF search_method .EQS. _HELP_CHAR
$	THEN
$	    _help_type = 10	! DNA4_SEARCH_METHOD
$	    GOSUB print_help
$	    GOTO DNA4_GET_SEARCH_TYPE
$	ENDIF
$!
$	DNA4_SEARCH_METHOD_LIST = "1/2"
$	I = 0
$!
$ CHECK_SEARCH_METHOD:
$!
$	LABEL = F$ELEMENT(I, "/", DNA4_SEARCH_METHOD_LIST)
$	IF LABEL .EQS. "/" THEN GOTO DNA4_GET_SEARCH_TYPE
$	IF search_method .EQS. LABEL THEN GOTO SEARCH_METHOD_CHOICE_MADE
$	I = I + 1
$	GOTO CHECK_SEARCH_METHOD
$!
$ SEARCH_METHOD_CHOICE_MADE:
$!
$	IF search_method .EQ. 1
$	THEN
$	    query_all = ""
$           report_search = "[1] ! Search by adjacency"
$	ELSE
$	    query_all = "-q "
$           report_search = "[2] ! Search by address"
$	ENDIF
$!
$	IF search_method .EQS. "2" THEN
$!
$   	IF F$TRNLNM("MCC_AC_UTIL_LOG") .EQS. 1
$	THEN
$	    echo ""
$	    echo "�� MCC_AC � Search type choice is: ''query_all'"
$	ENDIF
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_EXCL_LIST
$!
$!  Get DNA4 node exclusion list
$!
$!  Outputs:
$!
$!	area_exclude
$!	report_area_exclude
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_EXCL_LIST:
$!
$	excl_area_list = ""
$	count = 0
$!
$	echo ""
$	echo "      Please specify areas to exclude from the search."
$	echo ""
$	echo "      Enter one area at a time."
$!
$ DNA4_GET_EXCL_LIST2:
$!
$	echo ""
$	ask tmp_excl "o  Area to exclude: "
$!
$ CHECK_EXCL_ENTRY:
$!
$	tmp_excl = F$EDIT(tmp_excl, "TRIM, UPCASE, COMPRESS")
$!
$	IF (tmp_excl .EQS. "") THEN GOTO DONE_EXCL_AREA_LIST
$!
$	tmp_excl_option = F$EXTRACT(0, 1, tmp_excl)
$!
$	IF tmp_excl_option .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF tmp_excl_option .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 13	! EXCLUDE
$	    GOSUB print_help
$	    IF (count .EQ. 0)
$	    THEN
$	        GOTO DNA4_GET_EXCL_LIST
$	    ELSE
$		GOTO GET_ADDITIONAL_EXCL_AREA
$	    ENDIF
$	ENDIF
$!
$	integer_excl = F$INTEGER(tmp_excl)
$	IF integer_excl .GT. 63
$	THEN
$	    echo ""
$	    echo "        Error:  Area must be 63 or less."
$	    IF (count .EQ. 0)
$	    THEN
$	        GOTO DNA4_GET_EXCL_LIST2
$	    ELSE
$		GOTO GET_ADDITIONAL_EXCL_AREA
$	    ENDIF
$	ENDIF
$!
$	IF (count .EQ. 0)
$	THEN
$           excl_area_list = tmp_excl
$	ELSE
$           IF (tmp_excl .NES. "") THEN excl_area_list = excl_area_list + " " + tmp_excl
$	ENDIF
$!
$ GET_ADDITIONAL_EXCL_AREA:
$!
$	echo ""
$       echo         "        Press RETURN to end the list."
$	echo ""
$	ask tmp_excl "o  Additional area to exclude [''excl_area_list']: "
$!
$     	count = count + 1
$!
$     	GOTO CHECK_EXCL_ENTRY
$!
$ DONE_EXCL_AREA_LIST:
$!
$	IF excl_area_list .EQS. ""
$	THEN
$	    report_area_exclude = "None"
$	ELSE
$	    report_area_exclude = excl_area_list
$	ENDIF
$!
$	IF excl_area_list .EQS. ""
$	THEN
$           area_exclude = ""
$	ELSE
$ 	    const_str = " ""-E"" "
$	    Istr = excl_area_list
$	    GOSUB build_argument
$           area_exclude = Ostr
$	ENDIF
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$	THEN
$	    echo ""
$	    echo "�� MCC_AC � Exclude list is � ", area_exclude, " �"
$	ENDIF
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_BACKBONE
$!
$!  Get DNA4 backbone orientation preference
$!
$!  Outputs:
$!
$!	SW_V
$!	report_backbone
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_BACKBONE:
$!
$	echo ""
$	echo "        Please choose a backbone orientation:"
$	echo ""
$	echo "        [1] Horizontal"
$	echo "        [2] Vertical"
$	echo ""
$!
$	ask SW_V_choice "o  Enter option [1]: "
$!
$	SW_V_choice = F$EDIT(SW_V_choice, "TRIM, UPCASE, COMPRESS")
$	IF SW_V_choice .EQS. "" THEN SW_V_choice = "1"
$!
$	SW_V_choice = F$EXTRACT(0, 1, SW_V_choice)
$!
$	IF SW_V_choice .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF SW_V_choice .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 14	! DNA4_BACKBONE
$	    GOSUB print_help
$	    GOTO DNA4_BACKBONE
$	ENDIF
$!
$	DNA4_BACKBONE_LIST = "1/2"
$	I = 0
$!
$ CHECK_BACKBONE_OPTION:
$!
$	LABEL = F$ELEMENT(I, "/", DNA4_BACKBONE_LIST)
$	IF LABEL .EQS. "/" THEN GOTO DNA4_BACKBONE
$	IF SW_V_choice .EQS. LABEL THEN GOTO BACKBONE_CHOICE_MADE
$	I = I + 1
$	GOTO CHECK_BACKBONE_OPTION
$!
$ BACKBONE_CHOICE_MADE:
$!
$	IF SW_V_choice .EQS. "1"
$	THEN
$	    SW_V = ""
$	    report_backbone = "[1] ! Horizontal"
$	ELSE
$	    SW_V = """-V """
$	    report_backbone = "[2] ! Vertical"
$	ENDIF
$!
$   	IF F$TRNLNM("MCC_AC_UTIL_LOG") .EQS. 1
$	THEN
$	    echo ""
$           echo "�� MCC_AC � backbone choice is � ", SW_V, " �"
$	ENDIF
$!
$	RETURN good_status
$!-----------------------------------------------------------------------------------
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  PRINT_DNA4_CRITERIA_REPORT
$!
$!  Print a file which lists DNA4 search parameters
$!
$!  Inputs:
$!
$!	product_name
$!	_DNA4_CONFIG
$!	dna4_report_filename
$!	_START_TIME
$!	report_backbone
$!	report_search
$!	report_seed_node_list
$!	report_area_include
$!	report_area_exclude
$!
$!-----------------------------------------------------------------------------
$!
$ PRINT_DNA4_CRITERIA_REPORT:
$!
$	IF _DNA4_CONFIG .EQS. "2" .OR. -
           _DNA4_CONFIG .EQS. "5" .OR. -
           _DNA4_CONFIG .EQS. "8"
$	THEN
$	    report_type = 1
$	ELSE
$	    report_type = 2
$	ENDIF
$!
$	open/write/ERROR=REPORT_ERROR report_file dna4_report_filename
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file "        ''product_name' Search Parameters Report"
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file "                     ''_START_TIME'"
$	write/ERROR=REPORT_ERROR report_file ""
$!
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file "                 Domain name : ", _MCC_DOMAIN
$!
$	IF _DNA4_CONFIG .EQS. "1" THEN -
	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [1] ! All DECnet Phase IV nodes"
$!
$	IF _DNA4_CONFIG .EQS. "2"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [2] ! All DECnet Phase IV nodes in"
$	    write/ERROR=REPORT_ERROR report_file "                                   ! selected area(s)"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "3" THEN -
	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [3] ! All DECnet Phase IV nodes in a LAN"
$!
$	IF _DNA4_CONFIG .EQS. "4"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [4] ! All level 1 and level 2 DECnet Phase IV"
$	    write/ERROR=REPORT_ERROR report_file "                                   ! routers"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "5"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [5] ! ALL level 1 and level 2 DECnet Phase IV"
$	    write/ERROR=REPORT_ERROR report_file "                                   ! routers in selected area(s)"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "6"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [6] ! ALL level 1 and level 2 DECnet Phase IV"
$	    write/ERROR=REPORT_ERROR report_file "                                   ! routers on the LAN"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "7" THEN -
	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [7] ! All level 2 DECnet Phase IV routers"
$!
$	IF _DNA4_CONFIG .EQS. "8"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [8] ! All level 2 DECnet Phase IV routers"
	    write/ERROR=REPORT_ERROR report_file "                                   ! in selected area(s)"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "9"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [9] ! All level 2 DECnet Phase IV routers"
$           write/ERROR=REPORT_ERROR report_file "                                   ! on the LAN"
$	ENDIF
$!
$	IF report_type .EQ. 2
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "                Starting node(s) : [ ''report_seed_node_list' ]"
$	ENDIF
$!
$	IF report_type .EQ. 1
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "          Area(s) to include : [ ''report_area_include' ]"
$	ENDIF
$!
$	IF report_type .EQ. 1
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "          Area(s) to exclude : [ ''report_area_exclude' ]"
$	ENDIF
$!
$	IF report_type .EQ. 1
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "               Search method : ''report_search'"
$	ENDIF
$!
$	write/ERROR=REPORT_ERROR report_file "        Backbone orientation : ''report_backbone'"
$!
$	write/ERROR=REPORT_ERROR report_file ""
$	close/ERROR=REPORT_ERROR report_file
$!
$	GOTO DNA4_DONE_REPORT
$!
$ REPORT_ERROR:
$!
$	echo ""
$	echo "        Warning:  Error occurred writing ''product_name'"
$	echo "                  Search Parameters Report to file"
$	echo "                  ''dna4_report_filename'."
$	close report_file
$!
$ DNA4_DONE_REPORT:
$!
$ 	RETURN good_status
$!
$!$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  RUN_DNA4_COLLECTOR
$!
$!  Run mcc_ac_wan4_mapper to gather data about DECnet Phase IV entities.
$!
$!-----------------------------------------------------------------------------
$!
$ RUN_DNA4_COLLECTOR:
$!
$	echo ""
$	echo "        ''product_name' starting data collection ..."
$   	echo ""
$	echo "        This may take a while..."
$	echo ""
$!
$	IF seed_node_list .NES. ""
$       THEN
$ 	    const_str = " -s "
$           Istr = seed_node_list
$	    GOSUB build_argument
$           seed_node_list  = Ostr
$       ENDIF
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$	THEN
$	    echo ""
$           echo "�� MCC_AC � ***************** Call args to nice_collector ******************** "
$           echo "�� MCC_AC � Seed node list ...... � ''Seed_node_list' �"
$           echo "�� MCC_AC � SW_T ................ � ", SW_T,  "         �"
$           echo "�� MCC_AC � SW_L ................ � ", SW_L,  "         �"
            echo "�� MCC_AC � area_include ........ � ", area_include,  "  �"
            echo "�� MCC_AC � area_exclude ........ � ", area_exclude  ,"  �"
$           echo "�� MCC_AC � data_file ........... � - f ''data_file'      �"
$           echo "�� MCC_AC � query_all ........... � ''query_all'      �"
$!
$	    RETURN good_status
$	ENDIF
$!
$	nice_collector -d 1             -  ! Default debug flag
                       'seed_node_list' -  ! This will be empty for certain options
                       'SW_T'           -  !
                       'SW_L'           -  !
                       'area_include'   -  !
                       'area_exclude'   -  !
                       -f 'data_file'   -  !
                       'query_all'         !
$!
$	IF ($STATUS .EQ. %X00000003)
$	THEN
$	    echo ""
$           echo "        Error:  Data collection failed."
$     	    GOSUB quitscript_with_bad_status
$	ELSE
$	    echo ""
$           echo "        ''product_name' data collection completed."
$	    RETURN good_status
$	ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  RUN_DNA4_MAPPER
$!
$!  Run mcc_ac_wan4_mapper utility
$!
$!-----------------------------------------------------------------------------
$!
$ RUN_DNA4_MAPPER:
$!
$	echo ""
$	echo "        ''product_name' starting data formatting ..."
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$	THEN
$	    echo ""
$           echo "�� MCC_AC � ************* Call args to nice_mapper  ******************** "
$           echo "�� MCC_AC � SW_V ............ � ''SW_V'�"
$           echo "�� MCC_AC � decnet_range .... �''decnet_range'�"
$           echo "�� MCC_AC � root_oid ........ �''root_oid'�"
$           echo "�� MCC_AC � data_file........ �''data_file'�"
$!
$	    RETURN good_status
$	ENDIF
$!
$	nice_mapper -d 1                -
		    'SW_V' 		-
		    "-O" 'decnet_range' -
		    -f  'data_file'     -
		    "-N" '_MCC_DOMAIN'
$!
$	IF ($STATUS .EQ. %X00000003)
$	THEN
$	    echo ""
$           echo "        Error:  Data formatting failed."
$     	    GOSUB quitscript_with_bad_status
$	ELSE
$	    echo ""
$           echo "        ''product_name' data formatting completed."
$	    RETURN good_status
$	ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  RUN_SNMPMAP
$!
$!  Run snmpmap utility to gather data about IP entities.
$!
$!-----------------------------------------------------------------------------
$!
$ RUN_SNMPMAP:
$!
$	echo ""
$	echo "        Starting ''product_name' data collection ..."
$   	echo ""
$	echo "        This may take a while..."
$	echo ""
$!
$ 	if f$logical("MCC_AC_UTIL_LOG") .eq. 1
$	THEN
$	    echo ""
$           echo "�� MCC_AC � ************* Call args to IP SNMPMAP collector  ******************** "
$	    echo ""
$           echo "�� MCC_AC � Data File ......... [  -f ]     ''data_file'"
$           echo "�� MCC_AC � DBfile ............ [  -D ]     ''DBfile'"
$           echo "�� MCC_AC � EG File ........... [  -E ]     ''EGfile'"
$           echo "�� MCC_AC � Exception file .....[  -X ]     ''EXfile'"
$           echo "�� MCC_AC � first_oid ..........[  -O ]     ''first_oid'"
$	    echo ""
$	endif
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1 THEN -
	    RETURN good_status
$!
$	snmpmap  -f   'data_file' -
	       	"-D"  'DBfile' -
		"-E"  'EGfile'  -
		"-X"  'EXfile' -
		"-O"  'first_oid'
$!
$	IF ($STATUS .EQ. %X00000003)
$	THEN
$	    echo ""
$           echo "        Error:  Data collection failed."
$     	    GOSUB quitscript_with_bad_status
$	ELSE
$	    echo ""
$           echo "        ''product_name' data collection completed."
$	    RETURN good_status
$	ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : MAKE_CONFIG
$!
$!  Run makeconfig utility to create a configuration file.
$!
$!-----------------------------------------------------------------------------
$!---------------
$ IP_MAKE_CONFIG:
$!---------------
$	echo ""
$	echo "        ''product_name' building"
$	echo "              configuration file ''data_file'."
$	echo ""
$       @'makeconfig' 'data_file'
$       IF $STATUS
$       THEN
$           echo "        ''product_name' finished building configuration file."
$           echo "        You must edit this file to specify and verify the choice"
$           echo "        of configuration, including choice of host name, gateway, etc."
$	    echo ""
$   	    ask any_char "o  Press RETURN to edit ""''data_file'"": "
$!
$           RETURN good_status
$       ELSE
$	    echo ""
$	    echo "        Error:  Error building configuration file ''data_file'."
$           RETURN bad_status
$	ENDIF
$!============================================================================
$!
$!-----------------------
$ display_domain_and_dir_info:
$!-----------------------
$!
$    IF F$TRNLNM("MCC_AC_UTIL_LOG") .eqs. 1
$    THEN
$        echo  ""
$        echo  ""
$        echo  "   �� MCC_AC � mcc_map ............... �""''mcc_map'""�"
$        echo  "   �� MCC_AC � nice_mapper ........... �""''nice_mapper'""�"
$        echo  "   �� MCC_AC � nice_collector ........ �""''nice_collector'""�"
$        echo  "   �� MCC_AC � REGfile is "      , REGfile
$        echo  "   �� MCC_AC � DEREGfile is "    , DEREGfile
$	 if Topology_Type .EQS. ip_topology
$	 then
$               echo  "   �� MCC_AC � snmpmap ............... �""''snmpmap'""�"
$               echo  "   �� MCC_AC � mcc_makeconfig.com .... �""''makeconfig'""�"
$               echo  "   �� MCC_AC � data_file is "    , data_file
$               echo  "   �� MCC_AC � EXfile is "       , EXfile
$               echo  "   �� MCC_AC � DBfile is "       , DBfile
$               echo  "   �� MCC_AC � EGfile is "       , EGfile
$               echo  "   �� MCC_AC � AUTOfile is "     , AUTOfile
$               echo  "   �� MCC_AC � mcc_ac_edt_init.dat ... �""''EDTcommands'""�"
$	 endif
$        echo  ""
$        echo  ""
$    ENDIF
$!
$ return
$!=============================================================================
$!
$!=============================================================================
$ !------------------
$  do_clean_up:
$ !------------------
$ 	set_message_off
$ 	deassign sys$output
$!
$       CLOSE     snmp_prefix_file
$       CLOSE     node4_prefix_file
$       CLOSE     domain_prefix_file
$	CLOSE     rep_data_file
$	CLOSE     ns_data_file
$!
$       if f$search("sys$scratch:mcc$$_ac_'Topology_Type'_*.tmp;") .nes. "" then -
		delete/noconfirm/nolog    sys$scratch:mcc$$_ac_'Topology_Type'_*.tmp;*
$ 	set_message_on
$	return
$!=============================================================================
$!
$!=============================================================================
$!
$!    S C R I P T    S T A R T
$!
$!=============================================================================
$!
$ BEGIN:
$!
$	GOSUB print_intro
$!
$	GOSUB check_prefixes
$!
$	GOSUB get_domain_name
$!
$	GOSUB get_top_directory
$!
$	GOSUB set_working_directory
$!
$	GOSUB display_domain_and_dir_info
$!
$	GOSUB ask_copy_map_files
$!
$	GOSUB get_autoconfig_option
$!
$	GOSUB do_autoconfig
$!
$!  Delete files only if not debugging.
$!
$	IF F$TRNLNM("MCC_AC_UTIL_LOG") .NES. "1" .AND. -
	   F$TRNLNM("MCC_AC_UTIL_LOG") .NES. "2" THEN GOSUB delete_files
$!
$	GOSUB files_created
$!
$	GOSUB quitscript_with_good_status
$!
$       EXIT
$!============================================================================
$!
$!----------------------------------------------------------------------------
$!  Abort exit
$!----------------------------------------------------------------------------
$!
$ ABORT_EXIT:
$!
$	echo ""
$	echo "        ''product_name' ABORTED by user."
$	echo ""
$ 	echo "        Warning:  ''product_name' data files"
$	echo "                  may be corrupt."
$ 	GOSUB quitscript_with_good_status
$	EXIT
$!
$!----------------------------------------------------------------------------
$!  Error exit
$!----------------------------------------------------------------------------
$!
$ ERROR_EXIT:
$!
$	echo ""
$	echo "        Error:  An error has occurred."
$	echo ""
$ 	echo "        Warning:  ''product_name' data files"
$	echo "                  may be corrupt."
$ !--------------------
$ no_msg_error_exit:
$ !--------------------
$ 	GOSUB quitscript_with_bad_status
$	EXIT
$!
$!=============================================================================
$!
$!    S C R I P T    E N D
$!
$!=============================================================================
 | 
|  | $	_saved_verify = f$verify(0)
$ 	set noon
$ 	set control   = (t,y)
$!=============================================================================
$!
$!  Copyright (c) Digital Equipment Corporation, 1991 All Rights Reserved.
$!  Unpublished rights reserved under the copyright laws of the United States.
$!
$!  The software contained on this media is proprietary to and embodies the
$!  confidential technology of  Digital Equipment Corporation.  Possession,
$!  use, duplication or dissemination of the software and media is authorized
$!  only pursuant to a valid written license from Digital Equipment Corporation.
$!
$!
$!  RESTRICTED RIGHTS LEGEND   Use, duplication, or disclosure by the U.S.
$!  Government is subject to restrictions as set forth in Subparagraph
$!  (c)(1)(ii) of DFARS 252.227-7013, or in FAR 52.227-19, as applicable.
$!
$!                                      Digital Equipment Corporation
$!
$!=============================================================================
$!
$!  MCC_IP_AUTOCONFIG.COM | MCC_WAN4_AUTOCONFIG.COM
$!
$!  Command procedure to drive WAN4 data collection and map generation
$!  on VMS.
$!
$!=============================================================================
$!
$!  Modification History
$!
$!  Version	Date		Who	Comments
$!  -----------------------------------------------------------------------
$!  X11.00	28-MAY-1992     AVN     Restructured if-then-else statement
$!					in the routine GET_TOP_DIRECTORY
$!					Removed GOTO statement from inside the
$!                                      if-then-else statement to outside.
$!
$!  X10.00	15-MAY-1992   	UF	Removed version specs from purge
$!					statements to prevent DCL error.
$!					Modifed copy_map_files to print
$!					message correctly depending on option
$!					being processed (1 and 2 were
$!					switched).
$!					Fixed bug in files_created routine.
$!
$!  X9.00	13-MAY-1992   	UF	Modified delete_files to purge .cf*
$!					for DNA4 (not delete).
$!					Modified message printed when checking
$!					the namespace.
$!					Removed "DECmcc" from IP product name,
$!					to match DNA4.
$!					Modified to call copy_map_files after
$!					run_mcc_map in do_autoconfig, instead
$!					of in main routine.
$!					Modified print_intro to tell about
$!					"?" and "Q" at prompts.
$!					No longer support vertical backbone
$!					orientation.
$!					Modified text of question in
$!					ask_copy_map_files.
$!					Implemented logical name translation
$!					using f$parse in ask_copy_map_files.
$!					Modified display of main autoconfig
$!					options.
$!
$!  X8.00	 7-MAY-1992   	AV	Fixed the logic that checks directory
$!					spec.
$!
$!  X7.00	 9-APR-1992  	AV	Under option 5 for decnet seed node 
$!                                      question was not asked. Fixed some minor
$!                                      bugs too.
$!
$!  X6.00       08-APR-1992     UF      Few small changes to messages, etc.
$!
$!  X5.00       08-APR-1992     UF      If user enters "Q", always
$!				        quitscript_with_good_status, not
$!					abort_exit.
$!
$!  X4.00       08-APR-1992     UF      Modified get_top_directory to check
$!					for logical.  Check if directory
$!					exists before trying to set default!
$!
$!					Modified ABORT_EXIT to call
$!					quitscript_with_good status so
$!					".. exiting under error conditions"
$!					will not not be printed if user
$!					types "Q" in response to a prompt.
$!					Changed some error exit paths.
$!
$!  X3.00       03-APR-1992     UF      Edited help text; Fixed bugs in
$!                                      routines to get seed node, areas
$!					to include, and areas to exclude;
$!					Fixed formatting of some messages;
$!					Made other miscellaneous small changes.
$!
$!  X2.00	24-MAR-1992 	AV	Incorporated help text, prefix
$!                                      checking, etc.
$!
$!  X1.00	26-FEB-1992	UF	Original version, based on
$!					MCC_WAN4_AUTOCONFIG.COM.
$!
$!=============================================================================
$!
$!  File locations:
$!
$!    	executables			-  sys$library:
$!    	scripts				-  mcc_common:
$!    	autoconfiguration related files -  [<top directory>.[DNA4|IP].<domain name>]
$!
$!
$!=============================================================================
$!
$!  Specify which signals to trap
$!
$!  On Ultrix the following signals are trapped:
$!
$!	 1 = hangup
$!	 2 = interrupt
$! 	 3 = quit
$!      11 = segmentation violation
$!	15 = software termination (from kill(1))
$!
$!  	(<esc> may or may not be handled as signal 2)
$!
$!  On VMS we will trap ^T and ^Y
$!
$ 	on control_y then goto abort_exit
$       on warning then goto error_exit
$!
$       message_env              =   f$environment("MESSAGE")
$       set_message_off          =  "set message/nofacility/noidentification/noseverity/notext"
$       set_message_on           =  "set message''message_env'"
$       on_error_cont            =  "on error then continue"
$       on_ctrly_cont            =  "on control_y then continue"
$!
$	on_error_take_error_exit = "on error then goto error_exit"
$!
$!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$! 		Redefine some DCL command symbols to the original
$!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
$	DEFINE 	= "DEFINE"
$	READ 	= "READ"
$	WRITE 	= "WRITE"
$	OPEN 	= "OPEN"
$	DELETE 	= "DELETE"
$	COPY    = "COPY"
$!=============================================================================
$!
$!  Save the time when this procedure started, so we can list only those
$!  files created by this run.
$!
$!=============================================================================
$!
$	_START_TIME = F$TIME()
$!
$!=============================================================================
$!
$!  Symbol definitions
$!
$!=============================================================================
$!
$!-----------------------------------------------------------------------------
$!  General
$!-----------------------------------------------------------------------------
$!
$	general_product_name = "DECmcc Autoconfiguration"
$	prefix_file_name = "MCC_COMMON:MCC_AUTOCONFIG_PREFIX.DAT"
$!
$!-----------------------------------------------------------------------------
$!  DECnet Phase IV
$!-----------------------------------------------------------------------------
$!
$	dna4_topology            = "NICE"
$	dna4_dir                 = ".DNA4."
$       dna4_dir_help            = "DNA4"
$	dna4_product_name        = "DECnet Phase IV Autoconfiguration"
$!
$ 	decnet_range             = 25000
$       seed_node_list           = ""
$       seed_node_default_string = ""
$       query_all                = ""
$       area_exclude             = ""
$       area_include             = ""
$!
$!  No longer calling dna4_backbone().  Set defaults here.
$!
	SW_V_choice="1"
	SW_V=""
	report_backbone="[1] ! Horizontal"
$!
$!-----------------------------------------------------------------------------
$!  IP
$!-----------------------------------------------------------------------------
$!
$	ip_topology 		= "IP"
$	ip_dir 			= ".IP."
$       ip_dir_help             = "IP"
$	ip_product_name 	= "IP Autoconfiguration"
$!
$    	first_oid 		= 10000
$!
$!-----------------------------------------------------------------------------
$!  			Select Topology
$!-----------------------------------------------------------------------------
$!
$!=>!<=     Topology_Type = dna4_topology               !=>!<=   Please also change 
$!=>!<=     product_name  = dna4_product_name           !=>!<=   NICE to IP in mcc command
$!							! 	 Look for "=>!<="
$!-----------------------------------------------------------------------------
$! 	When the following lines are uncommented, this command file will
$!	work as front end to DECmcc IP Autoconfiguration.
$!
$!	Note: Comment out the above two lins when the following
$!	      two lines are uncommented.
$!-----------------------------------------------------------------------------
$!
$           Topology_Type =  ip_topology
$           product_name  =  ip_product_name
$!
$!-----------------------------------------------------------------------------
$!  General
$!-----------------------------------------------------------------------------
$       good_status         =  1
$       bad_status          =  0
$       echo                =  "Write sys$output"
$       ask                 =  "Inquire/nopunctuation"
$       exit_prompt         =  "o  Press RETURN to exit: "
$       _help_char          =  "?"
$       util_dir            =  "mcc_common:"
$       bin_dir             =   "sys$library:"
$       dnsctl 		    =   "mcr dns$control"
$       __domain_max_length =  10
$!-----------------------------------------------------------------------------
$!
$!=============================================================================
$!
$!  Define symbols for executables
$!
$!=============================================================================
$!
$     	if f$trnlnm("MCC_AC_MAP") .eqs. ""
$       then
$	    mcc_map   := $sys$library:MCC_AC_MAP.EXE
$       else
$	    mcc_map   = "$" + "''f$trnlnm("MCC_AC_MAP")'"
$     	endif
$!
$     	if f$trnlnm("MCC_AC_WAN4_COLLECTOR") .eqs. ""
$       then
$           nice_collector := $sys$library:MCC_AC_WAN4_COLLECTOR.EXE
$	else
$           nice_collector = "$" + "''f$trnlnm("MCC_AC_WAN4_COLLECTOR")"
$	endif
$!
$       if f$trnlnm("MCC_AC_WAN4_MAPPER") .eqs. ""
$       then
$          nice_mapper := $sys$library:MCC_AC_WAN4_MAPPER.EXE
$	else
$          nice_mapper = "$" + "''f$trnlnm("MCC_AC_WAN4_MAPPER") '"
$     	endif
$!
$    	if (f$trnlnm("MCC_AC_IP") .eqs. "")
$    	then
$           snmpmap := $'BIN_DIR'mcc_ac_ip.exe
$    	else
$           snmpmap = "$" + f$trnlnm("MCC_AC_IP")
$    	endif
$!
$	makeconfig  = "''UTIL_DIR'mcc_makeconfig.com"
$       EDTcommands = "''UTIL_DIR'mcc_ac_edt_init.dat"
$!
$!
$!=============================================================================
$!
$!  Set variables for directory and file specifications
$!
$!=============================================================================
$!
$	current_directory = F$TRNLNM("sys$disk") + F$DIRECTORY()
$!
$!=============================================================================
$!
$!  Let directories and files be owner and group writable.
$!
$!=============================================================================
$!
$	set protection=(owner:rwed,group:r)/default
$!
$!=============================================================================
$!
$!  Skip utility functions and to to start of script
$!
$!=============================================================================
$!
$	goto begin
$!
$!
$!=============================================================================
$!
$!  U T I L I T Y    F U N C T I O N S
$!
$!=============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : PRINT_INTRO
$!
$!  		Type topology-specific introductory message.
$!
$!  13-MAY-1992	UF	Modified to print information about responding
$!			to prompts with "?" or "Q".
$!-----------------------------------------------------------------------------
$!
$ PRINT_INTRO:
$!
$	echo ""
$	echo "        Welcome to ''product_name'"
$       echo ""
$       echo "        Type '?' for Help or 'Q' to Quit, at any of the prompts."
$       echo ""
$!
$    	return GOOD_STATUS
$!========================================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : QUITSCRIPT_WITH_GOOD_STATUS
$!
$!  Ask user to press RETURN to quit.  Exit with status = good_status.
$!
$!-----------------------------------------------------------------------------
$!
$ QUITSCRIPT_WITH_GOOD_STATUS:
$!
$	gosub do_clean_up
$	echo ""
$    	echo "        ''product_name' exiting."
$    	set def 'current_directory
$	echo ""
$!---------------
$ good_exit_confirm:
$!---------------
$    	ask any_char "''exit_prompt'"
$!
$	any_char = f$edit(any_char, "trim, upcase, compress")
$	any_char = F$EXTRACT(0, 1, any_char)
$	if any_char .eqs. _help_char
$ 	then
$	    _help_type = 8	! EXIT_HELP
$	    GOSUB print_help
$	    goto good_exit_confirm
$	endif
$!
$	_reset_verify = f$verify(_saved_verify)
$	EXIT good_status
$!
$!!    	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : QUITSCRIPT_WITH_BAD_STATUS
$!
$!  Ask user to press RETURN to quit.  Exit with status = bad_status.
$!
$!-----------------------------------------------------------------------------
$!---------------------------
$ QUITSCRIPT_WITH_BAD_STATUS:
$!---------------------------
$!
$	gosub do_clean_up
$	echo ""
$    	echo "        ''product_name' exiting under error conditions."
$    	set def 'current_directory'
$	echo ""
$!-----------------
$ bad_exit_confirm:
$!-----------------
$    	ask any_char "''exit_prompt'"
$!
$	any_char = f$edit(any_char, "trim, upcase, compress")
$	any_char = F$EXTRACT(0, 1, any_char)
$	if any_char .eqs. _help_char
$ 	then
$	    _help_type = 8	! EXIT_HELP
$	    GOSUB print_help
$	    goto bad_exit_confirm
$	endif
$!
$	_reset_verify = f$verify(_saved_verify)
$	EXIT good_status
$!
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : PRINT_HELP
$!
$!  Print context sensitive help for the user, based on the value
$!  of _HELP_TYPE.
$!
$!  Input:  _HELP_TYPE
$!
$!  13-MAY-1992   UF	Removed mention of "rightmost simplename" in help
$!			for DOMAIN.
$!-----------------------------------------------------------------------------
$!------------
$ PRINT_HELP:
$!------------
$	echo ""
$	echo "--------------------------------------------------------------------------------"
$!   1       2       3         4           5          6         7       8  
$! DOMAIN,TOPDIR,COPYFILES,AUTO_OPTION,YNCONTINUE,NAMESPACE,IP_CHOICE,EXIT
$!     9              10              11        12      13      14           15
$! DNA4_CONFIG,DNA4_SEARCH_METHOD,SEED_NODE,AREA_INCLUDE,EXCL,DNA4_BACKBONE,DOMAIN_OK
$!
$       help_choice = "1/2/3/4/5/6/7/8/9/10/11/12/13/14/15"
$ 	i = 0
$!------------------
$  check_help_choice:
$!------------------
$     label = f$element(i, "/", help_choice)
$!!
$!!   This is not possible as the input is from the program
$!!   if label .eqs. "/" then goto bad_choice		
$!!
$     if _help_type .eqs. label then goto help_'label'
$     i = i+1
$     goto check_help_choice
$!-------
$ help_1:		! DOMAIN
$!-------
$!
$ echo ""
$ echo "        Network entities discovered by ''product_name'"
$ echo "        must be registered before they can be managed by DECmcc."
$ echo ""
$ echo "        At the prompt, specify the name of the domain into which"
$ echo "        discovered entities should be placed during registration."
$ echo "        ''product_name' will use the"
$ echo "        ''general_product_name' prefix file to generate the"
$ echo "        fullname for the domain you specify."
$!
$	goto end_help
$!
$!-------
$ help_2:		! TOPDIR
$!-------
$!
$ echo ""
$ echo "        The configuration data collection and DECmcc Map file"
$ echo "        generation operations performed by ''product_name'"
$ echo "        result in the creation of a number of files.  These files are"
$ echo "        created in a subdirectory of the base directory you specify"
$ echo "        here."
$ echo ""
$ echo "        At the prompt, specify the directory which you would like"
$ echo "        ''product_name' to use as the base directory."
$ echo "        Please do not specify a logical name.  If not already present,"
$ echo "        ''product_name' will create the subdirectory 
$!
$	IF Topology_Type .EQS. dna4_topology
$	THEN
$           echo "        [.''dna4_dir_help'] in the directory you specify."
$       ELSE
$           echo "        [.''ip_dir_help'] in the directory you specify."
$       ENDIF
$!
$	goto end_help
$!
$!-------
$ help_3:		! COPYFILES
$!-------
$!
$ echo ""
$ echo "        DECmcc Map files generated by ''product_name'"
$ echo "        will be created in ""''working_dir'""."
$ echo "        If you are running ''product_name' from"
$ echo "        the DECmcc Iconic Map and you wish to view these DECmcc Maps"
$ echo "        without exiting DECmcc, answer "Y" to this question."
$!
$	goto end_help
$!
$!-------
$ help_4:		! AUTO_OPTION
$!-------
$!
$ echo ""
$ echo "        Choose option [1] at the prompt if you wish to collect"
$ echo "        configuration data and register entities found by"
$ echo "        ''product_name'.  Once option [1] is"
$ echo "        complete, you can display the DECmcc Maps which were"
$ echo "        created, and manage the entities found by"
$ echo "        ''product_name'."
$ echo ""
$ echo "        It is possible to view DECmcc Maps before running"
$ echo "        registration, using the DECmcc Map Snapshots option.  If"
$ echo "        you wish to do this, choose option [2] at the prompt."
$ echo "        This option is helpful if the scope of the collection is"
$ echo "        large, since registration may take significant time for a"
$ echo "        large area.  It is necessary to run registration, however,"
$ echo "        before you can manage the entities found by"
$ echo "        ''product_name'."
$ echo ""
$    	ask any_char "o  Press RETURN to continue: "
$ echo ""
$ echo "        You may reuse data obtained during an earlier data"
$ echo "        collection session, by chosing option [3] at the prompt."
$ echo "        Option [3] will produce DECmcc Registration and Map files"
$ echo "        using raw data saved in data files located in the working"
$ echo "        directory for the domain you have specified.  To register"
$ echo "        the entitites found by ''product_name',"
$ echo "        choose option [4] at the prompt."
$!
$	goto end_help
$!
$!-------
$ help_5:		! YNCONTINUE
$!-------
$!
$!	No-op
$!
$	goto end_help
$!
$!-------
$ help_6:		! NAMESPACE
$!-------
$!
$ echo ""
$ echo "        It is important that you complete namespace planning"
$ echo "        before running ''general_product_name'.  This includes"
$ echo "        reviewing the ''general_product_name' prefix file, as"
$ echo "        outlined in ""DECmcc Autoconfiguration and Autotopology Use""" 
$ echo "        manual."
$ echo ""
$ echo "        Please read this document before continuing."
$!
$	goto end_help
$!-------
$ help_7:		! IP_choice_help
$!-------
$!
$ echo ""
$ echo "        Your choice of configuration dictates the scope of"
$ echo "        data collection."
$ echo ""
$ echo "        The collection process can take a long time.  This time is"
$ echo "        dependent on the number of nodes to be discovered and the"
$ echo "        speed of the connections between nodes to be discovered.  "
$ echo ""
$ echo "        ''product_name' will create a default"
$ echo "        configuration specification, which you may use as a basis"
$ echo "        for your choice of configuration.  You must edit this file"
$ echo "        to specify and verify the choice of configuration, including"
$ echo "        choice of host name, gateway, etc."
$!
$	goto end_help
$!-------
$ help_8:		! Exit_help
$!-------
$!
$ echo ""
$ echo "        If you have invoked ''product_name'"
$ echo "        from the DECmcc Iconic Map, pressing RETURN at this"
$ echo "        point will cause the ''product_name'"
$ echo "        window disappear."
$ echo ""
$ echo "        If you would like to capture any messages that are"
$ echo "        currently displayed in this window, please do so before"
$ echo "        pressing RETURN."
$ echo ""
$ echo "--------------------------------------------------------------------------------"
$ echo ""
$!
$	goto no_quit_msg_exit
$!-------
$ help_9:	        ! DNA4_CONFIG
$!-------
$!
$ echo ""
$ echo "        Your choice of configuration dictates the scope of"
$ echo "        data collection."
$ echo ""
$ echo "        The collection process can take a long time.  This time is"
$ echo "        dependent on the number of nodes to be discovered and the"
$ echo "        speed of the connections between nodes to be discovered."
$ echo ""
$ echo "        ''product_name' has a node limit of 2000 nodes."
$ echo "        This limit should be considered when choosing a configuration."
$ echo ""
$ echo "        At the prompt, enter the number of the your configuration"
$ echo "        choice."
$!
$	goto end_help
$!--------
$ help_10:	        ! DNA4_SEARCH_METHOD
$!--------
$!
$ echo ""
$ echo "        ''product_name' collects configuration"
$ echo "        data by assembling a list of nodes to poll and by gathering"
$ echo "        information about each node in this list."
$ echo ""
$ echo "        This list can be generated in one of two ways, by"
$ echo "        ""adjacency search"" or ""address search"".  Using"
$ echo "        adjacency search, ''product_name' gathers"
$ echo "        information from nodes already found to discover"
$ echo "        additional nodes in the network.  Using the address search,"
$ echo "        ''product_name' polls all possible (1024)"
$ echo "        addresses in an area, gathering responses from any nodes"
$ echo "        with one of those addresses."
$ echo ""
$    	ask any_char "o  Press RETURN to continue: "
$ echo ""
$ echo "        Adjacency search is faster, but may not discover all nodes"
$ echo "        in an area.  Address search finds more nodes, but may take"
$ echo "        longer."
$ echo ""
$ echo "        Address search is recommended if the portion of your"
$ echo "        network for which you would like to collect data contains"
$ echo "        routers made by any vendor other than Digital."
$!
$	goto end_help
$!--------
$ help_11:	        ! SEED_NODE
$!--------
$!
$ echo ""
$ echo "        It is necessary to specify the node from which"
$ echo "        ''product_name' should start configuration data"
$ echo "        collection."
$ echo ""
$ echo "        It is possible to specify more than one starting node."
$ echo "        This is especially helpful, for instance, when a router does"
$ echo "        not support the NICE network management protocol.  In this"
$ echo "        case, you should specify a starting node on each side of the"
$ echo "        router."
$ echo ""
$ echo "        The starting node(s) you specify should be members of the"
$ echo "        area(s) which you would like to include in the data"
$ echo "        collection."
$ echo ""
$    	ask any_char "o  Press RETURN to continue: "
$ echo ""
$ echo "        If a starting node is not reachable from the system on which"
$ echo "        you are running ''product_name' or if a"
$ echo "        starting node is heavily protected, ''product_name'"
$ echo "        will encounter an error and data collection will stop."
$ echo ""
$ echo "        At the prompt, specify the starting nodes you would like"
$ echo "        ''product_name' to use, entering one node at a time."
$ echo "        Press RETURN to end the list."
$!
$	goto end_help
$!--------
$ help_12:	        ! AREA_INCLUDE
$!--------
$!
$ echo ""
$ echo "        ''product_name' is capable of collecting"
$ echo "        configuration data for more than one area in the network during"
$ echo "        one collection session, provided that the areas are directly"
$ echo "        connected together." 
$ echo ""
$ echo "        At the prompt, specify the areas you would like to include"
$ echo "        in the data collection, entering one node at a time.  Press"
$ echo "        RETURN to end the list."
$!
$	goto end_help
$!--------
$ help_13:	        ! EXCLUDE
$!--------
$!
$ echo ""
$ echo "        ''product_name' does not support collection of"
$ echo "        configuration information for hidden areas in your network."
$ echo ""
$ echo "        It is necessary to specify here all the hidden areas in your"
$ echo "        network, so that these areas can be excluded from the data"
$ echo "        collection."
$ echo ""
$ echo "        At the prompt, specify all hidden areas in your network,"
$ echo "        entering one node at a time.  Press RETURN to end the list."
$!
$	goto end_help
$!--------
$ help_14:	        ! DNA4_BACKBONE
$!--------
$!
$ echo ""
$ echo "        DECmcc Maps created by ''product_name'"
$ echo "        represent DECnet Phase IV backnones as a series of"
$ echo "        entities connected to either a horizontal or vertical line."
$ echo ""
$ echo "        If you wish backbones to be represented using a horizontal"
$ echo "        line, choose option [1].  Otherwise, choose option [2]."
$!
$	goto end_help
$!
$!-------
$ help_15:		! DOMAIN_OK
$!-------
$!
$ echo ""
$ echo "        Nodes discovered by ''product_name'"
$ echo "        must be registered before they can be managed"
$ echo "        from DECmcc."
$ echo ""
$ echo "        Verify the name of the domain into which discovered"
$ echo "        entities should be placed during registration.  If the"
$ echo "        name is correct, answer ""Y"" at the prompt.  Otherwise"
$ echo "        answer ""N"" and you will be given the opportunity to"
$ echo "        specify a new domain name."
$!
$	goto end_help
$!
$!------------
$ end_help:
$!------------
$!
$ echo ""
$ echo "        You may type "Q" to Quit ''product_name'."
$ echo ""
$ echo "--------------------------------------------------------------------------------"
$ echo ""
$    	ask any_char "o  Press RETURN to continue: "
$!-----------------
$ no_quit_msg_exit:
$!-----------------
$!
$	any_char = F$EDIT(any_char, "TRIM, UPCASE, COMPRESS")
$	IF any_char .EQS. "" THEN any_char = "Y"
$!
$	any_char = F$EXTRACT(0, 1, any_char)
$!
$	IF any_char .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	return GOOD_STATUS
$!
$!-----------------------------------------------------------------------------
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : GET_DOMAIN_NAME
$!
$!  Get domain name from user.
$!
$!  Input: _MCC_DOMAIN_PREFIX
$!
$!-----------------------------------------------------------------------------
$!------------------
$ get_domain_name:
$!------------------
$	echo ""
$	ask _MCC_DOMAIN "o  Please specify a domain: "
$!------------------
$ check_domain_name:
$!------------------
$	_mcc_domain = f$edit(_mcc_domain, "trim, upcase, compress")
$	if _mcc_domain .eqs. "Q" then gosub quitscript_with_good_status
$!
$	if _mcc_domain .eqs. _help_char
$ 	then
$	    _help_type = 1	! DOMAIN
$	    GOSUB print_help
$	    goto get_domain_name
$	endif
$!
$	if _mcc_domain .eqs. ""
$	then
$	    echo ""
$	    echo "        Error:  Domain name is required."
$	    GOTO GET_DOMAIN_NAME
$	ENDIF
$!
$	IF F$LENGTH(_MCC_DOMAIN) .GT. __DOMAIN_MAX_LENGTH
$	THEN
$	    echo ""
$	    echo "        Error:  Domain name is too long.  Name must be ''__DOMAIN_MAX_LENGTH'"
$	    echo "                characters or less."
$	    GOTO GET_DOMAIN_NAME
$	ENDIF
$!
$	IF F$LOCATE(".",_MCC_DOMAIN) .lt. F$LENGTH(_MCC_DOMAIN)
$ 	THEN
$	    echo ""
$	    echo "        Error:  Domain name cannot contain ""."""
$	    GOTO GET_DOMAIN_NAME
$	ENDIF
$!
$ VERIFY_DOMAIN:
$!
$	echo ""
$	echo "        Based on the prefix file on your system"
$	echo "        ''product_name' will use the domain"
$	echo "        ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$	echo ""
$       ask ok "o  Is ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'"" the correct domain name? Y/N [Y]: "
$!
$	ok = F$EDIT(ok, "TRIM, UPCASE, COMPRESS")
$	IF ok .EQS. "" THEN ok = "Y"
$!
$	ok = F$EXTRACT(0, 1, ok)
$	IF ok .EQS. "Y" THEN GOTO GOT_DOMAIN
$!
$	IF ok .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF ok .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 15	! DOMAIN_OK
$	    GOSUB print_help
$	    GOTO VERIFY_DOMAIN
$	ENDIF
$!
$	IF ok .EQS. "N"
$	THEN
$	    GOTO GET_DOMAIN_NAME
$	ELSE
$	    GOTO VERIFY_DOMAIN
$	ENDIF
$!
$ GOT_DOMAIN:
$!
$       RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : RUN_MCC_MAP
$!
$!  Run mcc_ac_map utility to generate MCC map file(s) and registration file(s)
$!  using data gathered by DNA4 utility.
$!
$!  Input:
$!
$!	Topology_Type : dna4_topology or ip_topology
$!
$!-----------------------------------------------------------------------------
$!
$ RUN_MCC_MAP:
$!
$	echo ""
$  	echo "        ''product_name' generating DECmcc Registration"
$	echo "        and Map files."
$   	echo ""
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$ 	THEN
$	    echo ""
$           echo "�� MCC_AC � **************** Call args to mcc_map ******************** "
$           echo "�� MCC_AC � data file ...... �''data_file'�"
$           echo "�� MCC_AC � domain ......... �''_MCC_DOMAIN'�"
$           echo "�� MCC_AC � working dir .... �''working_dir'�"
$!
	    RETURN good_status
$	ENDIF
$!
$   	mcc_map      -f  'data_file'   -
		    "-N" '_MCC_DOMAIN' -
		     -t  "''Topology_Type'"
$!
$     	IF ($STATUS .EQ. %X00000003)
$       THEN
$	    echo ""
$           echo "        Error:  Failed to generate DECmcc Registration and Map files."
$     	    GOSUB quitscript_with_bad_status
$       ELSE
$	    echo ""
$           echo "        ''product_name' finished generating DECmcc"
$	    echo "        Registration and Map files."
$     	    RETURN good_status
$       ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine: REGISTER_DOMAIN
$!
$!  Run registration scripts generated by mcc_ac_map.
$!
$!-----------------------------------------------------------------------------
$!
$ REGISTER_DOMAIN:
$!
$	echo ""
$	echo "        ''product_name' executing DECmcc Registration"
$	echo "        commands for domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$!
$  	IF F$LOGICAL("MCC_AC_UTIL_LOG") .eq. 1 THEN -
	    RETURN good_status
$!
$	IF F$SEARCH("''REGfile'") .NES. ""
$	THEN
$     	    @'REGfile'
$     	    IF $STATUS
$           THEN
$	        echo ""
$               echo "        ''product_name' finished executing DECmcc Registration commands."
$     	        RETURN good_status
$           ELSE
$	        echo ""
$               echo "        Error:  Failed to execute DECmcc Registration commands"
$		echo "                for domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$       	GOSUB quitscript_with_bad_status
$	    ENDIF
$	ELSE
$	    echo "        Error:  Command procedure ''REGfile' is missing."
$	    echo "                Unable to execute DECmcc Registration commands"
$	    echo "                for domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$           GOSUB quitscript_with_bad_status
$	ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : BUILD_ARGUMENT
$!
$!  Input:
$!
$!	Input Istr : Input string as gotten from the user
$!     	Const_Str  : A string (e.g. "-A") to embed between the white space
$!
$!  Output:
$!
$!      Ostr : Correctly formatted argument
$!
$!-----------------------------------------------------------------------------
$!
$ BUILD_ARGUMENT:
$!
$ 	Istr = f$edit(Istr, "COMPRESS, TRIM")
$ 	Sstr = Istr
$ 	done = "F"
$ 	Ostr = ""
$!
$ BEGIN_INSERTION:
$!
$ 	curr_position = F$LOCATE(" ", Sstr)
$!
$ 	IF curr_position .LT. F$LENGTH(Sstr)
$ 	THEN
$    	    Lstr = f$extract(0, curr_position, Sstr )
$    	    Rstr = f$extract( curr_position+1, F$LENGTH(Sstr), Sstr )
$    	    Ostr = Ostr + Const_Str + Lstr
$	    Sstr = Rstr
$ 	ELSE
$    	    done = "T"
$    	    Lstr = Sstr
$    	    Ostr = Ostr + Const_Str + Lstr
$ 	ENDIF
$!
$ 	IF .NOT. done THEN -
	    GOTO BEGIN_INSERTION
$!
$    	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$    	THEN
$	    echo ""
$           echo "�� MCC_AC � Input String .... � ''Istr' �"
$           echo "�� MCC_AC � Output String ... �", Ostr, " �"
$       ENDIF
$!
$ 	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : GET_TOP_DIRECTORY
$!
$!  Verify top directory, using sys$login as a default.  If sys$login
$!  is not the top directory the user wants, then ask for another.
$!
$!-----------------------------------------------------------------------------
$!
$ GET_TOP_DIRECTORY:
$!
$                     x = f$parse("sys$login") 
$       _MCC_AC_TOP_DIR = f$extract(0, f$length(x)-2, x) 
$!
$ SHOW_TOP_DIRECTORY:
$!
$	echo ""
$    	echo "        ''product_name' will use the base directory"
$	echo "        ""''_MCC_AC_TOP_DIR'""."
$	echo ""
$	ask ok "o  Is ""''_MCC_AC_TOP_DIR'"" the correct base directory? Y/N [Y]: "
$!
$	ok = F$EDIT(ok, "TRIM, UPCASE, COMPRESS")
$	IF ok .EQS. "" THEN ok = "Y"
$!
$	ok = F$EXTRACT(0, 1, ok)
$	IF ok .EQS. "Y" THEN GOTO GOT_DIRECTORY
$!
$	IF ok .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF ok .EQS. _HELP_CHAR
$	THEN
$           _HELP_TYPE = 2	! TOPDIR
$	    GOSUB print_help
$	    GOTO SHOW_TOP_DIRECTORY
$	ENDIF
$!
$ GET_DIR:
$!
$	IF ok .EQS. "N"
$	THEN
$	    echo ""
$	    ask _MCC_AC_TOP_DIR "o  Please specify a base directory: "
$	    _MCC_AC_TOP_DIR = F$EDIT(_MCC_AC_TOP_DIR, "TRIM, UPCASE, COMPRESS")
$!
$	    IF _MCC_AC_TOP_DIR .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	    IF _MCC_AC_TOP_DIR .EQS. ""
$	    THEN
$		echo ""
$		echo "        Error:  Directory specification is required."
$	        ok = "N"
$		GOTO GET_DIR
$	    ENDIF
$!
$	    IF _MCC_AC_TOP_DIR .EQS. _HELP_CHAR
$	    THEN
$               _HELP_TYPE = 2	! TOPDIR
$	        GOSUB print_help
$	        ok = "N"
$	        GOTO GET_DIR
$	    ENDIF
$!
$	    user_input = _MCC_AC_TOP_DIR  
$	    GOSUB GET_DIR_SPEC
$!
$	    IF invalid_dir .EQS. "TRUE"
$	    THEN
$	        echo ""
$		echo "        Error:  ""''_MCC_AC_TOP_DIR'"" is not a valid directory name " 
$	        ok = "N"
$		GOTO GET_DIR
$	    ELSE
$	       _MCC_AC_TOP_DIR  = dir_spec	
$	    ENDIF
$!
$	    IF F$SEARCH("''_MCC_AC_TOP_DIR'" + "*.*") .EQS. ""
$	    THEN
$	        echo ""
$		echo "        Error:  The directory you specified does not exist."
$	        ok = "N"
$		GOTO GET_DIR
$	    ENDIF
$	ENDIF
$!
$	GOTO SHOW_TOP_DIRECTORY
$!
$ GOT_DIRECTORY:
$!
$	RETURN good_status
$ !============================================================================
$ !
$ !=========================================================================================
$ !			get_dir_spec
$ !=========================================================================================
$ ! This routine will check for valid dir specification
$ ! If the specification is wrong for any reason 
$ ! the variable invalid_dir is set to "TRUE" and FALSE otherwise
$ ! If dir spec specified is okay actual directory specification
$ ! is returned in dir_spec vairable.
$ !	Input: 
$ !         user_input : the string that need to be validated 
$ !	Output:
$ !	    invalid_dir : Set to "TRUE" if invalid directory 	
$ !         		  is detected else is set to "FALSE"
$ !         dir_spec    : Is the valid dir spec. If invalid dir
$ !		          spec encountered then it is ""
$ !
$ !--------------
$  get_dir_spec:
$ !--------------
$	dir_spec = ""
$	invalid_dir = "TRUE"
$!
$ 	x = f$parse(user_input)
$ 	if x .nes. "" 
$ 	then
$          if (f$length(x)-2 .eq. f$locate(".;",x))                          
$          then                                                              
$             if ( (f$length(x)-3 .eq. f$locate("]",x))  -                    
                      .or. (f$length(x)-3 .eq. f$locate(">",x)) )             
$             then                                                            
$                 invalid_dir = "FALSE"                                   
$ 	          dir_spec = f$extract(0, f$length(x)-2, x)
$             endif                                                           
$          endif                                                             
$ 	endif
$! 
$       return
$!-----------------------------------------------------------------------------
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : SET_WORKING_DIRECTORY
$!
$!  Input :
$!
$!	_MCC_AC_TOP_DIR
$!	Topology_Type 	: dna4_topology or ip_topology
$!
$!  Set working_dir symbol, define filename symbols, and set default
$!  to working directory.
$!
$!-----------------------------------------------------------------------------
$!
$ SET_WORKING_DIRECTORY:
$!
$	IF Topology_Type .EQS. dna4_topology
$	THEN
$	    working_dir = "''_MCC_AC_TOP_DIR'" - "]" - ">" + "''dna4_dir'" + "''_MCC_DOMAIN'"
$	ELSE
$	    working_dir = "''_MCC_AC_TOP_DIR'" - "]" - ">" + "''ip_dir'" + "''_MCC_DOMAIN'"
$	ENDIF
$!
$ 	IF F$LOCATE("<", working_dir) .EQ. F$LENGTH(working_dir)
$ 	THEN
$	    working_dir = "''working_dir'" +  "]"
$ 	ELSE
$	    working_dir = "''working_dir'" +  ">"
$ 	ENDIF
$!
$  	IF F$TRNLNM("MCC_AC_UTIL_LOG") .EQS. 1
$	THEN
$	    echo ""
$           echo  "�� MCC_AC � 	working_dir...  �""''working_dir'""�"
$	ENDIF
$!
$   	data_file =  "''working_dir'" + "MCC_''_MCC_DOMAIN'" + ".CF"
$   	REGfile   =  "''working_dir'" + "MCC_''_MCC_DOMAIN'_REGISTRATION.COM"
$!
$	IF Topology_Type .EQS. ip_topology
$	THEN
$           EXfile      = "''working_dir'" + "MCC_''_MCC_DOMAIN'.EXCEPTIONS"
$           DBfile      = "''working_dir'" + "MCC_''_MCC_DOMAIN'.DBDUMP"
$           EGfile      = "''working_dir'" + "MCC_''_MCC_DOMAIN'.EDGES"
$       ELSE
$	    dna4_report_filename = "''working_dir'" + "MCC_''_MCC_DOMAIN'_SEARCH_PARAMETERS.DAT"
$	ENDIF
$!
$ 	IF F$SEARCH("''working_dir'" + "*.*") .EQS. ""
$ 	THEN
$	    echo ""
$	    create/dir/nolog 'working_dir'
$ 	ENDIF
$!
$   	set default 'working_dir'
$	echo ""
$	echo "        ''product_name' will use"
$	echo "        ""''working_dir'"" as a working"
$	echo "        directory."
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : CHECK_PREFIXES
$!
$!  Verify prefixes in MCC_AUTOCONFIG_PREFIX.DAT and if using DNS,
$!  check for presence of appropriate directories.
$!
$!-----------------------------------------------------------------------------
$!---------------
$ CHECK_PREFIXES:
$!---------------
$!
$!  By pass the check when debugging
$!
$	if f$logical("mcc_ac_util_log") .eq. 100 then goto Proper_Exit
$!
$	on_error_take_error_exit
$!
$!  Figure out if MIR or DNS
$!
$       echo ""
$	echo "        Checking the namespace.  This will take a moment.  Please wait..."
$       define/user sys$output nl:
$	manage/enter
          SHOW MCC 0          , to file SYS$SCRATCH:mcc$$_ac_IP_REP_SELECTION1.TMP         !=>!<=  Change NICE TO IP  !=>!<=
          SHOW MCC 0 ALL CHAR , to file SYS$SCRATCH:mcc$$_ac_IP_REP_NAME.TMP               !=>!<=  for IP script      !=>!<=
	exit
$!
$       search/out=sys$scratch:mcc$$_ac_'Topology_Type'_dNS_SELECTION2.tmp sys$scratch:mcc$$_ac_'Topology_Type'_rep_selection1.tmp  "Component Name"
$	search/out=sys$scratch:mcc$$_ac_'Topology_Type'_rep_selection2.tmp sys$scratch:mcc$$_ac_'Topology_Type'_rep_name.tmp        "Namespace Selection"
$!
$	open/read rep_data_file sys$scratch:mcc$$_ac_'Topology_Type'_rep_selection2.tmp
$	read rep_data_file REPOSITORY
$	close rep_data_file
$!
$	open/read ns_data_file sys$scratch:mcc$$_ac_'Topology_Type'_dNS_SELECTION2.tmp
$	read ns_data_file NS_SELECTION
$	close ns_data_file
$!
$	delete/noconfirm/nolog sys$scratch:mcc$$_ac_'Topology_Type'_dns_*.*;*
$	delete/noconfirm/nolog sys$scratch:mcc$$_ac_'Topology_Type'_rep_*.tmp;*
$!
$	repository = f$extract(f$locate("=",repository)+3, f$length(repository), repository)
$	repository = f$extract(0, f$length(repository)-1, repository)
$!
$	if repository .nes. "DECdns" then goto mir
$!------
$ DNS:
$!------
$!  Make sure this command procedure can run DNS$CONTROL program
$!
$	if f$search("sys$system:dns$control.exe") .eqs. "" then goto dns_no_files
$	if f$search("sys$system:dns$control.bin") .eqs. "" then goto dns_no_files
$	if f$search("sys$share:dns$lib.exe")      .eqs. "" then goto dns_no_files
$	goto dns_continue_1
$!-----------------
$ DNS_NO_FILES:
$!-----------------
$	echo ""
$       echo "        Error:  DNS$CONTROL program cannot be run on this system."
$	echo ""
$       echo "        Please make sure that following files exist:"
$	echo ""
$       echo "            SYS$SYSTEM:DNS$CONTROL.EXE - DNS control program"
$       echo "            SYS$SYSTEM:DNS$CONTROL.BIN - DNS management command parse table"
$       echo "            SYS$SHARE:DNS$LIB.EXE      - DNS shareable library"
$       echo ""
$       echo "        If you do not have access to these files, please run"
$       echo "        ''product_name' on a system which has"
$	echo "        a DNS server running."
$	goto l_nomsg_error_exit
$!-----------------
$ DNS_CONTINUE_1:
$!-----------------
$!  Determine namespace being used
$!
$	NS_SELECTION = f$extract( f$locate("=", NS_SELECTION)+2, f$length(NS_SELECTION), NS_SELECTION)
$	NS_SELECTION = f$extract(0, f$locate(":", NS_SELECTION)+1, NS_SELECTION)
$!
$!  Make sure DNS knows about the namespace
$!
$	on_error_cont
$       define/user sys$output nl:
$       define/user sys$error nl:
$       dnsctl show dir 'NS_SELECTION'.
$       o_severity = '$severity'
$	on_error_take_error_exit
$       if o_severity .ne. 1
$           then
$               echo ""
$               echo "        Error:  The ''NS_SELECTION' namespace does not exist"
$               echo "                or cannot be accessed."
$		goto l_nomsg_error_exit
$           endif
$!------
$ MIR:
$!------
$	DOMAIN_PREFIX = ""
$	NODE4_PREFIX = ""
$	SNMP_PREFIX = ""
$	NS_INIT_DOMAIN_PREFIX = 0
$	NS_INIT_NODE4_PREFIX = 0
$	NS_INIT_SNMP_PREFIX = 0
$	BAD_DOMAIN_PREFIX = 0
$	BAD_NODE4_PREFIX = 0
$	BAD_SNMP_PREFIX = 0
$!
$!  Read each prefix from the prefix file, verify the format, and
$!  check for the directory in DNS
$!
$  set_message_off
$  sear/match=and/out=sys$scratch:mcc$$_ac_'Topology_Type'_domain_prefix.tmp 'prefix_file_name' DOMAIN,   "|", ".","."
$  set_message_on
$  OPEN/READ domain_prefix_file       sys$scratch:mcc$$_ac_'Topology_Type'_domain_prefix.tmp
$  READ/End=domain_prefix_error      domain_prefix_file      domain_prefix_line
$  DOMAIN_PREFIX = F$EXTRACT(F$LOCATE("|",DOMAIN_PREFIX_LINE)+1, F$LENGTH(DOMAIN_PREFIX_LINE), DOMAIN_PREFIX_LINE)
$  DOMAIN_PREFIX = F$EDIT(domain_PREFIX, "TRIM")
$  CLOSE     domain_prefix_file
$!
$  set_message_off
$  sear/match=and/out=sys$scratch:mcc$$_ac_'Topology_Type'_node4_prefix.tmp 'prefix_file_name'  NODE4,  "|", ".","."
$  set_message_on
$  OPEN/READ node4_prefix_file       sys$scratch:mcc$$_ac_'Topology_Type'_node4_prefix.tmp
$  READ/End=node4_prefix_error       node4_prefix_file       node4_prefix_line
$  NODE4_PREFIX = F$EXTRACT(F$LOCATE("|",NODE4_PREFIX_LINE)+1, F$LENGTH(NODE4_PREFIX_LINE), NODE4_PREFIX_LINE)
$  NODE4_PREFIX = F$EDIT(node4_PREFIX, "TRIM")
$  CLOSE     node4_prefix_file
$!
$  set_message_off
$  sear/match=and/out=sys$scratch:mcc$$_ac_'Topology_Type'_snmp_prefix.tmp 'prefix_file_name'   SNMP,   "|", ".","."
$  set_message_on
$  OPEN/READ snmp_prefix_file        sys$scratch:mcc$$_ac_'Topology_Type'_snmp_prefix.tmp
$  READ/End=snmp_prefix_error             snmp_prefix_file        snmp_prefix_line
$  SNMP_PREFIX = F$EXTRACT(F$LOCATE("|",SNMP_PREFIX_LINE)+1, F$LENGTH(SNMP_PREFIX_LINE), SNMP_PREFIX_LINE)
$  SNMP_PREFIX = F$EDIT(snmp_PREFIX, "TRIM")
$  CLOSE     snmp_prefix_file
$!
$	delete/noconfirm/nolog    sys$scratch:mcc$$_ac_'Topology_Type'_*_prefix.tmp;*
$!-----------------------
$ VERIFY_PREFIX_PRESENCE:
$!-----------------------
$	IF (DOMAIN_PREFIX .EQS. "") .OR. (NODE4_PREFIX .EQS. "") .OR. (SNMP_PREFIX .EQS. "")
$	    THEN
$       	ECHO ""
$       	ECHO "        Error:  The ''general_product_name' prefix"
$	        ECHO "                file has not been set up properly."
$       	ECHO ""
$       	ECHO "        Prefixes for the following entity classes are not specified:"
$       	ECHO ""
$       	IF (DOMAIN_PREFIX .EQS. "") THEN ECHO "   DOMAIN"
$       	IF (NODE4_PREFIX .EQS. "") THEN ECHO "   NODE4"
$       	IF (SNMP_PREFIX .EQS. "") THEN ECHO "   SNMP"
$       	ECHO ""
$		ECHO "        Please edit the ''general_product_name' prefix"
$		ECHO "        file ''prefix_file_name' and"
$		ECHO "        rerun ''product_name'."
$		goto l_nomsg_error_exit
$	    ENDIF
$!---------------------
$ VERIFY_PREFIX_FORMAT:
$!---------------------
$!  			Verify that prefixes begin and end with "."
$!
$       dot = f$extract(f$length(domain_prefix)-1, 1, domain_prefix)
$       if (dot .nes. ".") then bad_domain_prefix = 1
$       dot = f$extract(f$length(node4_prefix)-1, 1, node4_prefix)
$       if (dot .nes. ".") then bad_node4_prefix = 1
$       dot = f$extract(f$length(snmp_prefix)-1, 1, snmp_prefix)
$       if (dot .nes. ".") then bad_snmp_prefix = 1
$!
$       dot = f$extract(0, 1, domain_prefix)
$       if (dot .nes. ".") then bad_domain_prefix = 1
$       dot = f$extract(0, 1, node4_prefix)
$       if (dot .nes. ".") then bad_node4_prefix = 1
$       dot = f$extract(0, 1, snmp_prefix)
$       if (dot .nes. ".") then bad_snmp_prefix = 1
$!
$	if (bad_domain_prefix .eq. 1) .or. (bad_node4_prefix .eq. 1) .or. (bad_snmp_prefix .eq. 1)
$	    then
$       	ECHO ""
$       	ECHO "        Error:  The ''general_product_name' prefix"
$	        ECHO "                file has not been set up properly."
$       	ECHO ""
$       	echo "        The following prefixes are invalid:"
$       	echo ""
$       	if (bad_domain_prefix .eq. 1) then echo "   ''domain_prefix'"
$       	if (bad_node4_prefix  .eq. 1) then echo "   ''node4_prefix'"
$       	if (bad_snmp_prefix   .eq. 1) then echo "   ''snmp_prefix'"
$       	echo ""
$		echo "        All prefixes must end with a ""."""
$       	echo ""
$       	ECHO ""
$		ECHO "        Please edit the ''general_product_name' prefix"
$		ECHO "        file ''prefix_file_name' and"
$		ECHO "        rerun ''product_name'."
$		goto l_nomsg_error_exit
$	    endif
$!
$!  Check for the directory in DNS
$!
$!--------------------
$ VERIFY_PREFIX_DIR:
$!--------------------
$	if repository .nes. "DECdns" then goto get_user_ok
$!
$	on_error_cont
$       	define/user sys$output nl:
$       	define/user sys$error nl:
$       	dnsctl show dir 'NS_SELECTION''domain_prefix'
$       	ns_init_domain_prefix = '$severity'
$	on_error_take_error_exit
$!
$	on_error_cont
$       	define/user sys$output nl:
$       	define/user sys$error nl:
$       	dnsctl show dir 'NS_SELECTION''node4_prefix'
$       	ns_init_node4_prefix = '$severity'
$	on_error_take_error_exit
$!
$	on_error_cont
$       	define/user sys$output nl:
$       	define/user sys$error nl:
$       	dnsctl show dir 'NS_SELECTION''snmp_prefix'
$       	ns_init_snmp_prefix = '$severity'
$	on_error_take_error_exit
$!
$	if (ns_init_domain_prefix .eq. 1) .and. (ns_init_node4_prefix .eq. 1) -
           .and. (ns_init_snmp_prefix .eq. 1) then goto get_user_ok
$!
$       echo ""
$       echo "        Error:  The ''general_product_name' prefix"
$	echo "                file has not been set up properly."
$       echo ""
$       echo "        The following directories have been specified"
$	echo "        in the prefix file but do not exist in ''NS_SELECTION':"
$       echo ""
$       if (ns_init_domain_prefix .ne. 1) then echo "           ''NS_SELECTION'''domain_prefix'"
$       if (ns_init_node4_prefix .ne. 1) then echo  "           ''NS_SELECTION'''node4_prefix'"
$       if (ns_init_snmp_prefix .ne. 1) then echo   "           ''NS_SELECTION'''snmp_prefix'"
$       echo ""
$	echo "        You may either create the above directories"
$	echo "        in ''NS_SELECTION' or edit the"
$	echo "        ''general_product_name' prefix file"
$	echo "        ''prefix_file_name' to match existing"
$	echo "        directories in ''NS_SELECTION'."
$!
$	goto l_nomsg_Error_exit
$!
$!--------------------
$ GET_USER_OK:
$!--------------------
$! Make sure the user wants to use the prefixes we found
$!
$	echo ""
$       echo "        ''product_name' will use the following prefixes"
$       echo "        to generate fullnames for registration:"
$       echo ""
$       echo "            Entity Class  Prefix"
$       echo ""
$       echo "            DOMAIN        ''DOMAIN_PREFIX'"
$       echo "            NODE4         ''NODE4_PREFIX'"
$       echo "            SNMP          ''SNMP_PREFIX'"
$       echo ""
$       ask answer "o  Are the above prefixes ok? Y/N [Y]: "
$	answer = f$edit(answer, "upcase,trim,collapse")
$	if (answer .eqs. "") then answer = "Y"
$	answer = F$EXTRACT(0, 1, answer)
$	if (answer .eqs. "Y") then goto proper_exit
$	if answer .eqs. _help_char
$	then
$	    _help_type = 6	! NAMESPACE
$	    GOSUB print_help
$	endif
$	if answer .eqs. _help_char then goto get_user_ok
$	if answer .eqs. "Q" then GOSUB quitscript_with_good_status
$	if answer .nes. "Y"
$	then
$           echo ""
$	    echo "        Please edit the ''general_product_name' prefix"
$	    echo "        file ''prefix_file_name' and"
$	    echo "        rerun ''product_name'."
$	    goto l_nomsg_Error_exit
$	endif
$!
$!--------------------
$ Proper_Exit:
$!--------------------
$!
$      if f$logical("mcc_ac_util_log") .eq. 100
$      then
$	   _MCC_DOMAIN_PREFIX = ".domain."
$	   _MCC_NODE4_PREFIX  = ".DNA_node."
$	   _MCC_SNMP_PREFIX   = ".ip."
$	else
$          _MCC_DOMAIN_PREFIX = DOMAIN_PREFIX
$          _MCC_NODE4_PREFIX  = NODE4_PREFIX
$          _MCC_SNMP_PREFIX   = SNMP_PREFIX
$	endif
$
$	RETURN good_status
$!
$!  Some error occured during processing.
$!
$!--------------------
$ l_nomsg_Error_exit:
$!--------------------
$ 	set_message_off
$	close rep_data_file
$	close ns_data_file
$	delete/noconfirm/nolog sys$scratch:mcc$$_ac_'Topology_Type'_dns_*.*;*
$	delete/noconfirm/nolog sys$scratch:mcc$$_ac_'Topology_Type'_rep_*.tmp;*
$ 	set_message_on
$       goto no_msg_error_exit
$!
$!--------------------
$ SNMP_prefix_error:
$!--------------------
$	echo ""
$       echo "        Error:  SNMP prefix information is required in"
$	echo "                the ''general_product_name' prefix file
$	echo "                ''prefix_file_name'."
$       goto no_msg_error_exit
$!--------------------
$ NODE4_prefix_error:
$!--------------------
$	echo ""
$       echo "        Error:  NODE4 prefix information is required in"
$	echo "                the ''general_product_name' prefix file
$	echo "                ''prefix_file_name'."
$       goto no_msg_error_exit
$!--------------------
$ domain_prefix_error:
$!--------------------
$	echo ""
$       echo "        Error:  DOMAIN prefix information is required in"
$	echo "                the ''general_product_name' prefix file
$	echo "                ''prefix_file_name'."
$       goto no_msg_error_exit
$!
$!-----------------------------------------------------------------------------
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : ASK_COPY_MAP_FILES
$!
$!  Confirm with user that map files should be copied to MCC_MAP.
$!
$!  Output : _COPY_MAP_FILES
$!		If 1, then files will be copied.  Else 0.
$! 	     _MAP_FILE_DESTINATION
$!		Directory to which map files should be copied.
$!
$!  13-MAY-1992 UF	Modified text of question about whether okay to
$!			copy files (on advice of tech writer).
$!-----------------------------------------------------------------------------
$!--------------------
$ ask_copy_map_files:
$!--------------------
$	_copy_map_files = 1
$	_copy_map_files_syslogin = 0
$!----------
$ ask_copy:
$!----------
$       x = f$parse("mcc_maps") 
$       _map_file_destination = f$extract(0, f$length(x)-2, x) 
$	if (_map_file_destination .eqs. "") 
$	then
$           x = f$parse("sys$login") 
$           _map_file_destination = f$extract(0, f$length(x)-2, x) 
$	    _copy_map_files_syslogin = 1
$	endif
$!
$ ASK_COPY2:
$!
$	echo ""
$	if _copy_map_files_syslogin .eq. 1
$	then
$	    echo "        The logical MCC_MAPS is not defined.  Therefore,"
$	    echo "        ''product_name' will copy DECmcc Map files to"
$	    echo "        your login directory, ""''_MAP_FILE_DESTINATION'""."
$	else
$	    echo "        ''product_name' will copy DECmcc Map"
$           echo "        files to MCC_MAPS, which is currently pointing"
$	    echo "        to the directory ""''_MAP_FILE_DESTINATION'""."
$	endif
$	echo ""
$	echo "o  Type N to prevent copying DECmcc Map files to"
$	ask ok "   ""''_MAP_FILE_DESTINATION'"". Y/N [Y]: "
$!
$	ok = f$edit(OK, "trim, upcase, compress")
$	if OK .eqs. "" then OK = "Y"
$!
$	OK = f$extract(0, 1, OK)
$	if OK .eqs. "Y" then goto c_done
$!
$	if OK .eqs. "Q" then gosub QUITSCRIPT_WITH_GOOD_STATUS
$!
$	if OK .eqs. _help_char
$	then
$           _help_type = 3      ! COPYFILES
$	    GOSUB print_help
$	    goto ask_copy
$	endif
$!
$	if ok .eqs. "N"
$	then
$	    _copy_map_files = 0
$	else
$	    goto ask_copy2
$	endif
$!
$ c_done:
$!
$	return GOOD_STATUS
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : COPY_MAP_FILES
$!
$!  Copy map files using command procedure, if _COPY_MAP_FILES = 1.
$!  If files are copied, then tell the user they can use them,
$!  either for opening the domain or map snapshots, depending on
$!  the value of _AUTOCONFIG_OPTION.
$!
$!  Input :
$!
$!	_MCC_DOMAIN
$!	_MCC_DOMAIN_PREFIX
$!	_AUTOCONFIG_OPTION
$!
$!  Output :
$!
$!	_COPY_MAP_FILES
$!	    If 1, then files will be copied.  Else 0.
$!
$! 	_MAP_FILE_DESTINATION
$!	    Directory to which map files should be copied.
$!
$! 15-MAY-1992	UF	Reflect the switch of options 1 and 2 in the message
$!			about displaying maps.
$!
$!-----------------------------------------------------------------------------
$!
$ COPY_MAP_FILES:
$!
$!
$	_MAP_FILES_COPIED = 0
$!
$	COPY_PROCEDURE = "MCC_''_MCC_DOMAIN'_COPY_MAPS.COM"
$!
$	IF _COPY_MAP_FILES .EQ. 1
$	THEN
$	    IF F$SEARCH("''copy_procedure'") .NES. ""
$	    THEN
$	        @'copy_procedure' "''_MAP_FILE_DESTINATION'"
$	        echo ""
$		echo "        DECmcc Map files copied to ""''_MAP_FILE_DESTINATION'""."
$	        _MAP_FILES_COPIED = 1
$	    ELSE
$	  	echo ""
$	 	echo "        Error:  Command procedure ''copy_procedure' is missing."
$		echo "                DECmcc Map files will not be copied."
$	    ENDIF
$	ENDIF
$!
$!  Tell the user they can use the maps now.
$!
$ 	IF _MAP_FILES_COPIED .EQ. 1
$	THEN
$	    IF _AUTOCONFIG_OPTION .EQS. "2" .OR. -
 	       _AUTOCONFIG_OPTION .EQS. "4"
$	    THEN
$	        echo ""
$               echo "        You may now open domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'""."
$	    ENDIF
$!
$	    IF _AUTOCONFIG_OPTION .EQS. "1" .OR. -
 	       _AUTOCONFIG_OPTION .EQS. "3"
$	    THEN
$		echo ""
$	        echo "        You may now view DECmcc Maps for domain ""''_MCC_DOMAIN_PREFIX'''_MCC_DOMAIN'"""
$	        echo "        using the ""DECmcc Map Snapshots"" option."
$	    ENDIF
$	ENDIF
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : DELETE_FILES
$!
$!  Delete files created by Autoconfiguration which are no longer needed.
$!
$!  Input:
$!
$!	Topology_Type : dna4_topology or ip_topology
$!
$!  13-May-1992 	UF	Modified to purge .cf* files for DNA4,
$!				not delete them.
$!  15-May-1992		UF	Removed version specs from PURGE statements.
$!-----------------------------------------------------------------------------
$!
$ DELETE_FILES:
$!
$	DELETE = "DELETE"
$!
$	IF Topology_Type .EQS. dna4_topology
$	THEN
$	    IF F$SEARCH("*.cf1;*") .NES. "" THEN PURGE/NOLOG/KEEP=3 *.cf1
$	    IF F$SEARCH("*.cf2;*") .NES. "" THEN PURGE/NOLOG/KEEP=3 *.cf2
$	    IF F$SEARCH("*.cf_exceptions;*") .NES. "" THEN PURGE/NOLOG/KEEP=3 *.cf_exceptions
$	ELSE
$	    IF F$SEARCH("*.dbdump;*") .NES. "" THEN DELETE/NOLOG *.dbdump;*
$	    IF F$SEARCH("*.edges;*") .NES. "" THEN DELETE/NOLOG *.edges;*
$	    IF F$SEARCH("*.exceptions;*") .NES. "" THEN DELETE/NOLOG *.exceptions;*
$	ENDIF
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : FILES_CREATED
$!
$!  List files created by Autoconfiguration since _START_TIME.
$!
$!  Inputs:
$!
$!	_START_TIME (Time this procedure started)
$!
$! 15-May-1992	UF	Fixed bug in f$search statement.
$!
$!-----------------------------------------------------------------------------
$!
$ FILES_CREATED:
$!
$	DIRECTORY = "DIRECTORY"
$!
$ 	IF F$SEARCH("''working_dir'" + "*.*") .NES. ""
$	THEN
$	    echo ""
$	    echo "        The following files were created by this"
$	    echo "        ''product_name' run:"
$	    echo ""
$	    DIRECTORY/DATE/SIZE/SINCE="''_START_TIME'" 'working_dir'
$	ELSE
$	    echo ""
$	    echo "        No files were created by this ''product_name' run."
$	ENDIF
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : GET_AUTOCONFIG_OPTION
$!
$!  Ask user what they want to do.
$!
$!  Output:  _AUTOCONFIG_OPTION = "1", "2", "3", or "4"
$!
$!-----------------------------------------------------------------------------
$!
$ GET_AUTOCONFIG_OPTION:
$!
$	_PRINT_STAR = 0
$!
$	_REG_ONLY = 0
$	IF F$SEARCH("MCC_''_MCC_DOMAIN'_REGISTRATION.COM") .NES. "" THEN -
		_REG_ONLY = 1
$!
$	_CREATE_MAP_FILES = 0
$	IF ((F$SEARCH("MCC_''_MCC_DOMAIN'.CFA") .NES "") .AND. -
	    (F$SEARCH("MCC_''_MCC_DOMAIN'.CFB") .NES "") .AND. -
	    (F$SEARCH("MCC_''_MCC_DOMAIN'.CFC") .NES "")) THEN -
		_CREATE_MAP_FILES = 1
$!
$ GET_OPTION:
$!
$	echo ""
$	echo "        Please choose one of the following"
$	echo "        ''product_name' options:"
$	echo ""
$	echo "        [1] Discovery"
$	echo "        [2] Discovery and Registration"
$	IF _CREATE_MAP_FILES
$	THEN
$	    echo "        [3] Creation of Map and Registration Files"
$	ELSE
$	    _PRINT_STAR = 1
$	    echo "      * [3] Creation of Map and Registration Files"
$	ENDIF
$	IF _REG_ONLY
$	THEN
$	    echo "        [4] Registration"
$	ELSE
$	    _PRINT_STAR = 1
$	    echo "      * [4] Registration"
$ 	ENDIF
$	echo ""
$	echo "        Note that it is possible to view DECmcc Maps before running"
$	echo "        registration, using the ""DECmcc Map Snapshots"" option."
$	echo "        If you wish to do this, choose option [1]."
$	echo ""
$	IF (_PRINT_STAR)
$	THEN
$	    echo "        * These options are disabled until supporting files"
$	    echo "          are created by choosing option [1] or [2]."
$	    echo ""
$	ENDIF
$!
$	ask _AUTOCONFIG_OPTION "o  Enter option [2]: "
$!
$	_AUTOCONFIG_OPTION = F$EDIT(_AUTOCONFIG_OPTION, "TRIM, UPCASE, COMPRESS")
$	IF _AUTOCONFIG_OPTION .EQS. "" THEN _AUTOCONFIG_OPTION = "2"
$!
$	_AUTOCONFIG_OPTION = F$EXTRACT(0, 1, _AUTOCONFIG_OPTION)
$!
$	IF _AUTOCONFIG_OPTION .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF _AUTOCONFIG_OPTION .EQS. _HELP_CHAR
$	THEN
$           _HELP_TYPE = 4      ! AUTO_OPTION
$	    GOSUB print_help
$	    GOTO GET_OPTION
$	ENDIF
$!
$	_CHOICE_LIST = "1/2"
$	IF _REG_ONLY THEN _CHOICE_LIST = _CHOICE_LIST + "/3"
$	IF _CREATE_MAP_FILES THEN _CHOICE_LIST = _CHOICE_LIST + "/4"
$!
$	I = 0
$!
$ CHECK_AUTO_OPTION:
$!
$	LABEL = F$ELEMENT(I, "/", _CHOICE_LIST)
$	IF LABEL .EQS. "/" THEN GOTO BAD_AUTO_OPTION
$	IF _AUTOCONFIG_OPTION .EQS. LABEL THEN GOTO CHOICE_MADE
$	I = I + 1
$	GOTO CHECK_AUTO_OPTION
$!
$ BAD_AUTO_OPTION:
$!
$	GOTO GET_OPTION
$!
$ CHOICE_MADE:
$!
$	IF _AUTOCONFIG_OPTION .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : DO_AUTOCONFIG
$!
$!  Perfom autoconfig action chosen by user, depending on topology_type.
$!
$!  Input:
$!
$!	_AUTOCONFIG_OPTION ("1", "2", "3", or "4")
$!	Topology_Type : dna4_topology or ip_topology
$!
$!  13-MAY-1992 	UF	Modified to call copy_map_files after
$!				run_mcc_map.
$!-----------------------------------------------------------------------------
$!
$ DO_AUTOCONFIG:
$!
$	IF _AUTOCONFIG_OPTION .EQS. "1" .OR. -
 	   _AUTOCONFIG_OPTION .EQS. "2"
$	THEN
$	    GOSUB do_autoconfig_discovery
$	ENDIF
$!
$	IF _AUTOCONFIG_OPTION .EQS. "1" .OR. -
	   _AUTOCONFIG_OPTION .EQS. "2" .OR. -
 	   _AUTOCONFIG_OPTION .EQS. "3"
$	THEN
$	    GOSUB run_mcc_map
$	    GOSUB copy_map_files
$	ENDIF
$!
$	IF _AUTOCONFIG_OPTION .EQS. "2" .OR. -
 	   _AUTOCONFIG_OPTION .EQS. "4"
$	THEN
$	    GOSUB register_domain
$	ENDIF
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : DO_AUTOCONFIG_DISCOVERY
$!
$!  Perfom autoconfig discovery, depending on topology_type.
$!
$!  Input:
$!
$!	Topology_Type : dna4_topology or ip_topology
$!
$!-----------------------------------------------------------------------------
$!
$ DO_AUTOCONFIG_DISCOVERY:
$!
$	IF Topology_Type .EQS. dna4_topology
$	THEN
$	    GOSUB get_dna4_criteria
$!
$	    GOSUB run_dna4_collector
$!
$	    GOSUB run_dna4_mapper
$	ELSE
$	    GOSUB get_ip_criteria
$!
$	    GOSUB run_snmpmap
$	ENDIF
$!
$	RETURN good_status
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  GET_IP_CRITERIA
$!
$!  Get IP collection criteria from the user
$!
$!-----------------------------------------------------------------------------
$!
$ GET_IP_CRITERIA:
$!
$!=============================================================================
$!
$!  Generate the initial configuration file if it does not already exist.
$!
$!=============================================================================
$!
$    	foo = f$search("''data_file'")
$    	if (FOO .eqs. "")
$    	then
$           gosub ip_make_config
$	    if $status
$	    then
$	        gosub edit_IP_cf_file
$    	    endif
$       else
$	    gosub handle_IP_ans
$       endif
$!
$	RETURN
$!============================================================================
$!---------------
$ handle_IP_ans:
$!---------------
$
$	echo ""
$	echo "        You already have a configuration file in your working directory.
$!----------------
$ handle_IP_ans_0:
$!----------------
$	echo ""
$       echo "        Do you wish to:"
$!-----------------
$ handle_IP_ans_1:
$!-----------------
$       echo ""
$       echo "        [1] Build a new default configuration file."
$       echo "        [2] Edit the existing configuration file."
$       echo "        [3] Run the ''product_name' utility."
$	echo ""
$	ask ans " o Enter option [2] : "
$!
$       ans = F$EDIT(ans,"UPCASE,TRIM,COMPRESS")
$	if ans .eqs. "" then ans = "2"
$	ans = F$EXTRACT(0, 1, ans)
$       ans_choice = "1/2/3/Q/''_help_char'"
$       i = 0
$!----------------------
$ l_check_menu_choice:
$!----------------------
$!
$       label = f$element(i, "/", ans_choice)
$    	if label .eqs. "/" then goto l_bad_menu_choice
$    	if ans .eqs. _help_char then goto IP_choice_help
$    	if ans .eqs. label  then goto IP_choice_'label'
$    	i = i + 1
$!
$    	goto l_check_menu_choice
$!--------------------
$ l_bad_menu_choice:
$!--------------------
$	echo ""
$    	echo "        Please choose one of the following:"
$    	GOTO handle_IP_ans_1
$!------------
$ IP_choice_1:
$!------------
$   	gosub ip_make_config
$   	if $status
$   	then
$     	    gosub edit_IP_cf_file
$   	endif
$   	goto handle_IP_ans_0
$!
$!------------
$ IP_choice_2:
$!------------
$   	gosub edit_IP_cf_file
$   	goto handle_IP_ans_0
$!
$!------------
$ IP_choice_3:
$!------------
$   	goto l_GET_IP_CRITERIA_done
$!
$!------------
$ IP_choice_Q:
$!------------
$   	GOSUB quitscript_with_good_status
$!
$!---------------
$ IP_choice_help:
$!---------------
$!
$   	_help_type = 7	! IP_CHOICE
$   	GOSUB print_help
$   	goto handle_IP_ans_0
$
$!-----------------------
$ l_GET_IP_CRITERIA_done:
$!-----------------------
$	RETURN
$!
$!-----------------
$ edit_IP_cf_file:
$!-----------------
$!
$    	define/nolog/user sys$input sys$command:
$    	edit = "edit"
$    	edit/edt/nojournal/command='EDTcommands' 'data_file'
$!
$	return GOOD_STATUS
$!
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  GET_DNA4_CRITERIA
$!
$!  Get DNA4 collection criteria from the user
$!
$!  13-MAY-1992	UF	Commented out calls to dna4_backbone().  Option
$!			no longer supported.  Orientation is always horizontal.
$!-----------------------------------------------------------------------------
$!
$ GET_DNA4_CRITERIA:
$!
$	echo ""
$	echo "        Please choose one of the following configurations:"
$       echo  ""
$	echo "        [1] All DECnet Phase IV nodes"
$	echo "        [2] All DECnet Phase IV nodes in selected area(s)"
$	echo "        [3] All DECnet Phase IV nodes in a LAN"
$	echo ""
$	echo "        [4] All level 1 and level 2 DECnet Phase IV routers"
$	echo "        [5] ALL level 1 and level 2 DECnet Phase IV routers in selected area(s)"
$	echo "        [6] ALL level 1 and level 2 DECnet Phase IV routers on the LAN"
$	echo ""
$	echo "        [7] All level 2 DECnet Phase IV routers"
$	echo "        [8] All level 2 DECnet Phase IV routers in selected area(s)"
$	echo "        [9] All level 2 DECnet Phase IV routers in the LAN"
$	echo ""
$!
$	ask _DNA4_CONFIG "o  Enter option [2]: "
$!
$	_DNA4_CONFIG = F$EDIT(_DNA4_CONFIG, "TRIM, UPCASE, COMPRESS")
$	IF _DNA4_CONFIG .EQS. "" THEN _DNA4_CONFIG = "2"
$!
$	_DNA4_CONFIG = F$EXTRACT(0, 1, _DNA4_CONFIG)
$!
$	IF _DNA4_CONFIG .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF _DNA4_CONFIG .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 9	! DNA4_CONFIG
$	    GOSUB print_help
$	    GOTO GET_DNA4_CRITERIA
$	ENDIF
$!
$ 	DNA4_CONFIG_LIST = "1/2/3/4/5/6/7/8/9"
$       I = 0
$!
$ CHECK_DNA4_CONFIG_CHOICE:
$!
$	LABEL = F$ELEMENT(I, "/", DNA4_CONFIG_LIST)
$	IF LABEL .EQS. "/" THEN GOTO GET_DNA4_CRITERIA
$	IF _DNA4_CONFIG .EQS. LABEL THEN GOTO DNA4_CHOICE_MADE
$	I = I + 1
$	GOTO CHECK_DNA4_CONFIG_CHOICE
$!
$ DNA4_CHOICE_MADE:
$!
$	GOTO DNA4_L'_DNA4_CONFIG'
$!
$ DNA4_L1:
$!
$    	SW_T = """-T"" 1"
$    	SW_L = """-L"" 1"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L2:
$!
$    	SW_T  = """-T"" 1"
$    	SW_L  = """-L"" 2"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_search_type
$	GOSUB dna4_get_seed_node_list
$    	GOSUB dna4_get_area_list
$    	GOSUB dna4_get_excl_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L3:
$!
$    	SW_T  = """-T"" 1"
$    	SW_L  = """-L"" 3"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L4:
$!
$    	SW_T  = """-T"" 2"
$    	SW_L  = """-L"" 1"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L5:
$!
$    	SW_T  = """-T"" 2"
$    	SW_L  = """-L"" 2"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_search_type
$    	GOSUB dna4_get_seed_node_list
$    	GOSUB dna4_get_area_list
$    	GOSUB dna4_get_excl_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L6:
$!
$    	SW_T  = """-T"" 2"
$    	SW_L  = """-L"" 3"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L7:
$!
$    	SW_T  = """-T"" 3"
$    	SW_L  = """-L"" 1"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L8:
$!
$    	SW_T  = """-T"" 3"
$    	SW_L  = """-L"" 2"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_search_type
$	GOSUB dna4_get_seed_node_list
$    	GOSUB dna4_get_area_list
$    	GOSUB dna4_get_excl_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ DNA4_L9:
$!
$    	SW_T  = """-T"" 3"
$    	SW_L  = """-L"" 3"
$    	GOSUB dna4_get_node_info
$    	GOSUB dna4_get_seed_node_list
$!!	GOSUB dna4_backbone
$	GOTO GOT_DNA4_CRITERIA
$!
$ GOT_DNA4_CRITERIA:
$!
$	GOSUB PRINT_DNA4_CRITERIA_REPORT
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_NODE_INFO
$!
$!  Get DNA4 node information
$!
$!  Outputs:
$!
$!	seed_node
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_NODE_INFO:
$!
$	mcr ncp show exec to sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp1.tmp
$       search/out=sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp2.tmp sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp1.tmp	"Executor node"
$!
$ 	open/read/ERROR=GET_NODE_ERROR dat_file sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp2.tmp
$ 	read/END_OF_FILE=GET_NODE_ERROR dat_file n_add
$       close dat_file
$	IF F$SEARCH("sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp%.tmp;*") .NES. "" THEN -
            delete/noconf/nolog sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp%.tmp;*
$!
$       n_add = f$extract(f$locate("=", n_add) + 2,f$length(n_add),n_add)
$       n_add = f$extract(0, f$locate("(",n_add)-1,n_add)
$       area_number = f$extract(0, f$locate(".",n_add), n_add)
$       node_number = f$extract(f$locate(".",n_add)+1,f$length(n_add) - f$locate(".",n_add), n_add)
$!
$	seed_node = seed_node_default_string + n_add
$!	seed_node_list = seed_node
$!
$	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$ 	THEN
$	    echo ""
$           echo "�� MCC_AC � seed_node is: ", seed_node
$           echo "�� MCC_AC � node_number is: ''node_number'"
$           echo "�� MCC_AC � area_number is: ''area_number'"
$ 	ENDIF
$!
$	RETURN good_status
$!
$ GET_NODE_ERROR:
$!
$	echo ""
$	echo "        Error: Error determining default starting node."
$       close dat_file
$	IF F$SEARCH("sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp%.tmp;*") .NES. "" THEN -
            delete/noconf/nolog sys$scratch:mcc$$_ac_'Topology_Type'_dna4_temp%.tmp;*
$	GOSUB quitscript_with_bad_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_SEED_NODE_LIST
$!
$!  Get DNA4 seed node information
$!
$!  Outputs:
$!
$!	seed_node_list
$!	report_seed_node_list
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_SEED_NODE_LIST:
$!
$!  Bypass this question if the search is done by address!
$!
$  	if query_all .eqs. "-q " then goto done_seed_node_list
$!
$    	seed_node_list = seed_node
$    	count = 0
$    	use_default = "F"
$!
$	echo ""
$	echo    "         Please specify starting nodes for the search."
$	echo    "         Enter one node at a time."
$	echo ""
$       ask tmp "o  Starting node [''seed_node_list']: "
$!
$	tmp = F$EDIT(tmp, "TRIM, UPCASE, COMPRESS")
$       IF tmp .EQS. "Q" THEN GOSUB quitscript_with_good_status
$	IF tmp .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 11	! SEED_NODE
$	    GOSUB print_help
$	    GOTO DNA4_GET_SEED_NODE_LIST
$	ENDIF
$!
$!----------------------------
$ get_more_seed_node_list:
$!----------------------------
$!
$    	if (tmp .nes. "Q")         ! <=
$    	then
$           if (count .eq. 0) .and. (tmp .eqs. "")
$           then
$	        echo ""
$		echo    "        Press RETURN to end the list."
$	   	echo ""
$          	ask tmp "o  Additional starting node(s) [''seed_node_list']: "
$!
$		tmp = F$EDIT(tmp, "TRIM, UPCASE, COMPRESS")
$       	IF tmp .EQS. "Q" THEN GOSUB quitscript_with_good_status
$		IF tmp .EQS. _HELP_CHAR
$		THEN
$	    	    _HELP_TYPE = 11	! SEED_NODE
$	    	    GOSUB print_help
$	    	    GOTO GET_MORE_SEED_NODE_LIST
$		ENDIF
$!
$		IF tmp .NES. _HELP_CHAR THEN -
          	    seed_node_list = seed_node_list + " " +  tmp
$	   	if tmp .eqs. "" then use_default = "T"
$          	tmp = seed_node_list
$           else
$          	if (count .eq. 1) .and. (tmp .nes. "")
$          	then
$		    IF tmp .NES. _HELP_CHAR THEN -
 	                seed_node_list = tmp
$	      	    echo ""
$             	    echo    "        Press RETURN to end the list."
$	      	    echo ""
$                   ask tmp "o  Additional starting node(s) [''seed_node_list']: "
$!
$		    tmp = F$EDIT(tmp, "TRIM, UPCASE, COMPRESS")
$       	    IF tmp .EQS. "Q" THEN GOSUB quitscript_with_good_status
$		    IF tmp .EQS. _HELP_CHAR
$		    THEN
$	    	        _HELP_TYPE = 11	! SEED_NODE
$	    	        GOSUB print_help
$	    	        GOTO GET_MORE_SEED_NODE_LIST
$		    ENDIF
$!
$	        else
$                   if (count .gt. 1) .and. (tmp .nes. "")
$                   then
$		        IF tmp .NES. _HELP_CHAR THEN -
 			    seed_node_list = seed_node_list + " " +  tmp
$	           	echo ""
$                  	echo    "        Press RETURN to end the list."
$	           	echo ""
$       	   	ask tmp "o  Additional starting node(s) [''seed_node_list']: "
$!
$		        tmp = F$EDIT(tmp, "TRIM, UPCASE, COMPRESS")
$       	        IF tmp .EQS. "Q" THEN GOSUB quitscript_with_good_status
$		        IF tmp .EQS. _HELP_CHAR
$		        THEN
$	    	            _HELP_TYPE = 11	! SEED_NODE
$	    	            GOSUB print_help
$	    	            GOTO GET_MORE_SEED_NODE_LIST
$		        ENDIF
$!
$              	    endif
$               endif
$           endif
$    	endif
$!
$	if use_default .eqs. "T" then goto done_seed_node_list
$      	if (tmp .eqs. "") .and. (count .gt. 0) then goto done_seed_node_list
$!
$      	if tmp .eqs. "Q" then gosub quitscript_with_good_status
$!
$       count = count + 1
$ 	goto get_more_seed_node_list
$!
$!---------------------
$  done_seed_node_list:
$!---------------------
$       count = 0
$!
$	report_seed_node_list = seed_node_list
$!
$ 	if f$logical("mcc_ac_util_log") .eq. 1
$ 	then
$           echo "�� MCC_AC � Seed list is �''seed_node_list'�"
$ 	endif
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_AREA_LIST
$!
$!  Get DNA4 area list
$!
$!  Outputs:
$!
$!  	area_include
$!	report_area_include
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_AREA_LIST:
$!
$	incl_area_list = area_number
$	count = 0
$!
$	echo ""
$	echo "        Please specify areas to include in the search."
$	echo ""
$	echo "        Enter one area at a time."
$!
$ DNA4_GET_AREA_LIST2:
$!
$	echo ""
$	ask tmp_area "o  Area to include [''incl_area_list']: "
$!
$ CHECK_AREA_ENTRY:
$!
$	tmp_area = F$EDIT(tmp_area, "TRIM, UPCASE, COMPRESS")
$!
$	tmp_area_option = F$EXTRACT(0, 1, tmp_area)
$!
$	IF tmp_area_option .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF tmp_area_option .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 12 	! AREA_INCLUDE
$	    GOSUB print_help
$	    IF (count .EQ. 0)
$	    THEN
$	        GOTO DNA4_GET_AREA_LIST
$	    ELSE
$		GOTO GET_ADDITIONAL_AREA
$	    ENDIF
$	ENDIF
$!
$	integer_area = F$INTEGER(tmp_area)
$	IF integer_area .GT. 63
$	THEN
$	    echo ""
$	    echo "        Error:  Area must be 63 or less."
$	    IF (count .EQ. 0)
$	    THEN
$	        GOTO DNA4_GET_AREA_LIST
$	    ELSE
$		GOTO GET_ADDITIONAL_AREA
$	    ENDIF
$	ENDIF
$!
$	IF (count .EQ. 0) 
$	THEN
$           IF (tmp_area .NES. "") THEN incl_area_list = tmp_area
$	ELSE
$	    IF (tmp_area .EQS. "")
$	    THEN
$		GOTO DONE_GET_AREA_LIST
$	    ELSE
$               incl_area_list = incl_area_list + " " + tmp_area
$	    ENDIF
$	ENDIF
$!
$ GET_ADDITIONAL_AREA:
$!
$       echo ""
$       echo         "        Press RETURN to end the list."
$       echo ""
$	ask tmp_area "o  Additional area to include [''incl_area_list']: "
$!
$     	count = count + 1
$!
$     	GOTO CHECK_AREA_ENTRY
$!
$ DONE_GET_AREA_LIST:
$!
$	report_area_include = incl_area_list
$!
$	const_str = " ""-A"" "
$	Istr = incl_area_list
$	GOSUB build_argument
$	area_include = Ostr
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$	THEN
$	    echo ""
$	    echo "�� MCC_AC � Area include list is � ", incl_area_list, " �"
$	    echo "�� MCC_AC � Areas to include � ", area_include, " �"
$	ENDIF
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_SEARCH_TYPE
$!
$!  Get DNA4 search type
$!
$!  Outputs:
$!
$!	guery_all
$!	report_search
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_SEARCH_TYPE:
$!
$	search_method  = 1
$!
$	echo ""
$	echo "        Please choose a search method:"
$	echo ""
$       echo "        [1] Search by adjacency"
$       echo "        [2] Search by address"
$	echo ""
$!
$	ask search_method "o  Enter option [1]: "
$!
$	search_method = F$EDIT(search_method, "TRIM, UPCASE, COMPRESS")
$	IF search_method .EQS. "" THEN search_method = 1
$!
$	search_method = F$EXTRACT(0, 1, search_method)
$!
$	IF search_method .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF search_method .EQS. _HELP_CHAR
$	THEN
$	    _help_type = 10	! DNA4_SEARCH_METHOD
$	    GOSUB print_help
$	    GOTO DNA4_GET_SEARCH_TYPE
$	ENDIF
$!
$	DNA4_SEARCH_METHOD_LIST = "1/2"
$	I = 0
$!
$ CHECK_SEARCH_METHOD:
$!
$	LABEL = F$ELEMENT(I, "/", DNA4_SEARCH_METHOD_LIST)
$	IF LABEL .EQS. "/" THEN GOTO DNA4_GET_SEARCH_TYPE
$	IF search_method .EQS. LABEL THEN GOTO SEARCH_METHOD_CHOICE_MADE
$	I = I + 1
$	GOTO CHECK_SEARCH_METHOD
$!
$ SEARCH_METHOD_CHOICE_MADE:
$!
$	IF search_method .EQ. 1
$	THEN
$	    query_all = ""
$           report_search = "[1] ! Search by adjacency"
$	ELSE
$	    query_all = "-q "
$           report_search = "[2] ! Search by address"
$	ENDIF
$!
$	IF search_method .EQS. "2" THEN
$!
$   	IF F$TRNLNM("MCC_AC_UTIL_LOG") .EQS. 1
$	THEN
$	    echo ""
$	    echo "�� MCC_AC � Search type choice is: ''query_all'"
$	ENDIF
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_GET_EXCL_LIST
$!
$!  Get DNA4 node exclusion list
$!
$!  Outputs:
$!
$!	area_exclude
$!	report_area_exclude
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_GET_EXCL_LIST:
$!
$	excl_area_list = ""
$	count = 0
$!
$	echo ""
$	echo "      Please specify areas to exclude from the search."
$	echo ""
$	echo "      Enter one area at a time."
$!
$ DNA4_GET_EXCL_LIST2:
$!
$	echo ""
$	ask tmp_excl "o  Area to exclude: "
$!
$ CHECK_EXCL_ENTRY:
$!
$	tmp_excl = F$EDIT(tmp_excl, "TRIM, UPCASE, COMPRESS")
$!
$	IF (tmp_excl .EQS. "") THEN GOTO DONE_EXCL_AREA_LIST
$!
$	tmp_excl_option = F$EXTRACT(0, 1, tmp_excl)
$!
$	IF tmp_excl_option .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF tmp_excl_option .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 13	! EXCLUDE
$	    GOSUB print_help
$	    IF (count .EQ. 0)
$	    THEN
$	        GOTO DNA4_GET_EXCL_LIST
$	    ELSE
$		GOTO GET_ADDITIONAL_EXCL_AREA
$	    ENDIF
$	ENDIF
$!
$	integer_excl = F$INTEGER(tmp_excl)
$	IF integer_excl .GT. 63
$	THEN
$	    echo ""
$	    echo "        Error:  Area must be 63 or less."
$	    IF (count .EQ. 0)
$	    THEN
$	        GOTO DNA4_GET_EXCL_LIST2
$	    ELSE
$		GOTO GET_ADDITIONAL_EXCL_AREA
$	    ENDIF
$	ENDIF
$!
$	IF (count .EQ. 0)
$	THEN
$           excl_area_list = tmp_excl
$	ELSE
$           IF (tmp_excl .NES. "") THEN excl_area_list = excl_area_list + " " + tmp_excl
$	ENDIF
$!
$ GET_ADDITIONAL_EXCL_AREA:
$!
$	echo ""
$       echo         "        Press RETURN to end the list."
$	echo ""
$	ask tmp_excl "o  Additional area to exclude [''excl_area_list']: "
$!
$     	count = count + 1
$!
$     	GOTO CHECK_EXCL_ENTRY
$!
$ DONE_EXCL_AREA_LIST:
$!
$	IF excl_area_list .EQS. ""
$	THEN
$	    report_area_exclude = "None"
$	ELSE
$	    report_area_exclude = excl_area_list
$	ENDIF
$!
$	IF excl_area_list .EQS. ""
$	THEN
$           area_exclude = ""
$	ELSE
$ 	    const_str = " ""-E"" "
$	    Istr = excl_area_list
$	    GOSUB build_argument
$           area_exclude = Ostr
$	ENDIF
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$	THEN
$	    echo ""
$	    echo "�� MCC_AC � Exclude list is � ", area_exclude, " �"
$	ENDIF
$!
$	RETURN good_status
$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  DNA4_BACKBONE
$!
$!  Get DNA4 backbone orientation preference
$!
$!  Outputs:
$!
$!	SW_V
$!	report_backbone
$!
$!-----------------------------------------------------------------------------
$!
$ DNA4_BACKBONE:
$!
$	echo ""
$	echo "        Please choose a backbone orientation:"
$	echo ""
$	echo "        [1] Horizontal"
$	echo "        [2] Vertical"
$	echo ""
$!
$	ask SW_V_choice "o  Enter option [1]: "
$!
$	SW_V_choice = F$EDIT(SW_V_choice, "TRIM, UPCASE, COMPRESS")
$	IF SW_V_choice .EQS. "" THEN SW_V_choice = "1"
$!
$	SW_V_choice = F$EXTRACT(0, 1, SW_V_choice)
$!
$	IF SW_V_choice .EQS. "Q" THEN GOSUB quitscript_with_good_status
$!
$	IF SW_V_choice .EQS. _HELP_CHAR
$	THEN
$	    _HELP_TYPE = 14	! DNA4_BACKBONE
$	    GOSUB print_help
$	    GOTO DNA4_BACKBONE
$	ENDIF
$!
$	DNA4_BACKBONE_LIST = "1/2"
$	I = 0
$!
$ CHECK_BACKBONE_OPTION:
$!
$	LABEL = F$ELEMENT(I, "/", DNA4_BACKBONE_LIST)
$	IF LABEL .EQS. "/" THEN GOTO DNA4_BACKBONE
$	IF SW_V_choice .EQS. LABEL THEN GOTO BACKBONE_CHOICE_MADE
$	I = I + 1
$	GOTO CHECK_BACKBONE_OPTION
$!
$ BACKBONE_CHOICE_MADE:
$!
$	IF SW_V_choice .EQS. "1"
$	THEN
$	    SW_V = ""
$	    report_backbone = "[1] ! Horizontal"
$	ELSE
$	    SW_V = """-V """
$	    report_backbone = "[2] ! Vertical"
$	ENDIF
$!
$   	IF F$TRNLNM("MCC_AC_UTIL_LOG") .EQS. 1
$	THEN
$	    echo ""
$           echo "�� MCC_AC � backbone choice is � ", SW_V, " �"
$	ENDIF
$!
$	RETURN good_status
$!-----------------------------------------------------------------------------------
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  PRINT_DNA4_CRITERIA_REPORT
$!
$!  Print a file which lists DNA4 search parameters
$!
$!  Inputs:
$!
$!	product_name
$!	_DNA4_CONFIG
$!	dna4_report_filename
$!	_START_TIME
$!	report_backbone
$!	report_search
$!	report_seed_node_list
$!	report_area_include
$!	report_area_exclude
$!
$!-----------------------------------------------------------------------------
$!
$ PRINT_DNA4_CRITERIA_REPORT:
$!
$	IF _DNA4_CONFIG .EQS. "2" .OR. -
           _DNA4_CONFIG .EQS. "5" .OR. -
           _DNA4_CONFIG .EQS. "8"
$	THEN
$	    report_type = 1
$	ELSE
$	    report_type = 2
$	ENDIF
$!
$	open/write/ERROR=REPORT_ERROR report_file dna4_report_filename
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file "        ''product_name' Search Parameters Report"
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file "                     ''_START_TIME'"
$	write/ERROR=REPORT_ERROR report_file ""
$!
$	write/ERROR=REPORT_ERROR report_file ""
$	write/ERROR=REPORT_ERROR report_file "                 Domain name : ", _MCC_DOMAIN
$!
$	IF _DNA4_CONFIG .EQS. "1" THEN -
	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [1] ! All DECnet Phase IV nodes"
$!
$	IF _DNA4_CONFIG .EQS. "2"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [2] ! All DECnet Phase IV nodes in"
$	    write/ERROR=REPORT_ERROR report_file "                                   ! selected area(s)"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "3" THEN -
	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [3] ! All DECnet Phase IV nodes in a LAN"
$!
$	IF _DNA4_CONFIG .EQS. "4"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [4] ! All level 1 and level 2 DECnet Phase IV"
$	    write/ERROR=REPORT_ERROR report_file "                                   ! routers"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "5"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [5] ! ALL level 1 and level 2 DECnet Phase IV"
$	    write/ERROR=REPORT_ERROR report_file "                                   ! routers in selected area(s)"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "6"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [6] ! ALL level 1 and level 2 DECnet Phase IV"
$	    write/ERROR=REPORT_ERROR report_file "                                   ! routers on the LAN"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "7" THEN -
	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [7] ! All level 2 DECnet Phase IV routers"
$!
$	IF _DNA4_CONFIG .EQS. "8"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [8] ! All level 2 DECnet Phase IV routers"
	    write/ERROR=REPORT_ERROR report_file "                                   ! in selected area(s)"
$	ENDIF
$!
$	IF _DNA4_CONFIG .EQS. "9"
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "        Configuration option : [9] ! All level 2 DECnet Phase IV routers"
$           write/ERROR=REPORT_ERROR report_file "                                   ! on the LAN"
$	ENDIF
$!
$	IF report_type .EQ. 2
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "                Starting node(s) : [ ''report_seed_node_list' ]"
$	ENDIF
$!
$	IF report_type .EQ. 1
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "          Area(s) to include : [ ''report_area_include' ]"
$	ENDIF
$!
$	IF report_type .EQ. 1
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "          Area(s) to exclude : [ ''report_area_exclude' ]"
$	ENDIF
$!
$	IF report_type .EQ. 1
$	THEN
$	    write/ERROR=REPORT_ERROR report_file "               Search method : ''report_search'"
$	ENDIF
$!
$	write/ERROR=REPORT_ERROR report_file "        Backbone orientation : ''report_backbone'"
$!
$	write/ERROR=REPORT_ERROR report_file ""
$	close/ERROR=REPORT_ERROR report_file
$!
$	GOTO DNA4_DONE_REPORT
$!
$ REPORT_ERROR:
$!
$	echo ""
$	echo "        Warning:  Error occurred writing ''product_name'"
$	echo "                  Search Parameters Report to file"
$	echo "                  ''dna4_report_filename'."
$	close report_file
$!
$ DNA4_DONE_REPORT:
$!
$ 	RETURN good_status
$!
$!$!
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  RUN_DNA4_COLLECTOR
$!
$!  Run mcc_ac_wan4_mapper to gather data about DECnet Phase IV entities.
$!
$!-----------------------------------------------------------------------------
$!
$ RUN_DNA4_COLLECTOR:
$!
$	echo ""
$	echo "        ''product_name' starting data collection ..."
$   	echo ""
$	echo "        This may take a while..."
$	echo ""
$!
$	IF seed_node_list .NES. ""
$       THEN
$ 	    const_str = " -s "
$           Istr = seed_node_list
$	    GOSUB build_argument
$           seed_node_list  = Ostr
$       ENDIF
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$	THEN
$	    echo ""
$           echo "�� MCC_AC � ***************** Call args to nice_collector ******************** "
$           echo "�� MCC_AC � Seed node list ...... � ''Seed_node_list' �"
$           echo "�� MCC_AC � SW_T ................ � ", SW_T,  "         �"
$           echo "�� MCC_AC � SW_L ................ � ", SW_L,  "         �"
            echo "�� MCC_AC � area_include ........ � ", area_include,  "  �"
            echo "�� MCC_AC � area_exclude ........ � ", area_exclude  ,"  �"
$           echo "�� MCC_AC � data_file ........... � - f ''data_file'      �"
$           echo "�� MCC_AC � query_all ........... � ''query_all'      �"
$!
$	    RETURN good_status
$	ENDIF
$!
$	nice_collector -d 1             -  ! Default debug flag
                       'seed_node_list' -  ! This will be empty for certain options
                       'SW_T'           -  !
                       'SW_L'           -  !
                       'area_include'   -  !
                       'area_exclude'   -  !
                       -f 'data_file'   -  !
                       'query_all'         !
$!
$	IF ($STATUS .EQ. %X00000003)
$	THEN
$	    echo ""
$           echo "        Error:  Data collection failed."
$     	    GOSUB quitscript_with_bad_status
$	ELSE
$	    echo ""
$           echo "        ''product_name' data collection completed."
$	    RETURN good_status
$	ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  RUN_DNA4_MAPPER
$!
$!  Run mcc_ac_wan4_mapper utility
$!
$!-----------------------------------------------------------------------------
$!
$ RUN_DNA4_MAPPER:
$!
$	echo ""
$	echo "        ''product_name' starting data formatting ..."
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1
$	THEN
$	    echo ""
$           echo "�� MCC_AC � ************* Call args to nice_mapper  ******************** "
$           echo "�� MCC_AC � SW_V ............ � ''SW_V'�"
$           echo "�� MCC_AC � decnet_range .... �''decnet_range'�"
$           echo "�� MCC_AC � root_oid ........ �''root_oid'�"
$           echo "�� MCC_AC � data_file........ �''data_file'�"
$!
$	    RETURN good_status
$	ENDIF
$!
$	nice_mapper -d 1                -
		    'SW_V' 		-
		    "-O" 'decnet_range' -
		    -f  'data_file'     -
		    "-N" '_MCC_DOMAIN'
$!
$	IF ($STATUS .EQ. %X00000003)
$	THEN
$	    echo ""
$           echo "        Error:  Data formatting failed."
$     	    GOSUB quitscript_with_bad_status
$	ELSE
$	    echo ""
$           echo "        ''product_name' data formatting completed."
$	    RETURN good_status
$	ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine :  RUN_SNMPMAP
$!
$!  Run snmpmap utility to gather data about IP entities.
$!
$!-----------------------------------------------------------------------------
$!
$ RUN_SNMPMAP:
$!
$	echo ""
$	echo "        Starting ''product_name' data collection ..."
$   	echo ""
$	echo "        This may take a while..."
$	echo ""
$!
$ 	if f$logical("MCC_AC_UTIL_LOG") .eq. 1
$	THEN
$	    echo ""
$           echo "�� MCC_AC � ************* Call args to IP SNMPMAP collector  ******************** "
$	    echo ""
$           echo "�� MCC_AC � Data File ......... [  -f ]     ''data_file'"
$           echo "�� MCC_AC � DBfile ............ [  -D ]     ''DBfile'"
$           echo "�� MCC_AC � EG File ........... [  -E ]     ''EGfile'"
$           echo "�� MCC_AC � Exception file .....[  -X ]     ''EXfile'"
$           echo "�� MCC_AC � first_oid ..........[  -O ]     ''first_oid'"
$	    echo ""
$	endif
$!
$ 	IF F$LOGICAL("MCC_AC_UTIL_LOG") .EQ. 1 THEN -
	    RETURN good_status
$!
$	snmpmap  -f   'data_file' -
	       	"-D"  'DBfile' -
		"-E"  'EGfile'  -
		"-X"  'EXfile' -
		"-O"  'first_oid'
$!
$	IF ($STATUS .EQ. %X00000003)
$	THEN
$	    echo ""
$           echo "        Error:  Data collection failed."
$     	    GOSUB quitscript_with_bad_status
$	ELSE
$	    echo ""
$           echo "        ''product_name' data collection completed."
$	    RETURN good_status
$	ENDIF
$!============================================================================
$!
$!-----------------------------------------------------------------------------
$!
$!  Subroutine : MAKE_CONFIG
$!
$!  Run makeconfig utility to create a configuration file.
$!
$!-----------------------------------------------------------------------------
$!---------------
$ IP_MAKE_CONFIG:
$!---------------
$	echo ""
$	echo "        ''product_name' building"
$	echo "              configuration file ''data_file'."
$	echo ""
$       @'makeconfig' 'data_file'
$       IF $STATUS
$       THEN
$           echo "        ''product_name' finished building configuration file."
$           echo "        You must edit this file to specify and verify the choice"
$           echo "        of configuration, including choice of host name, gateway, etc."
$	    echo ""
$   	    ask any_char "o  Press RETURN to edit ""''data_file'"": "
$!
$           RETURN good_status
$       ELSE
$	    echo ""
$	    echo "        Error:  Error building configuration file ''data_file'."
$           RETURN bad_status
$	ENDIF
$!============================================================================
$!
$!-----------------------
$ display_domain_and_dir_info:
$!-----------------------
$!
$    IF F$TRNLNM("MCC_AC_UTIL_LOG") .eqs. 1
$    THEN
$        echo  ""
$        echo  ""
$        echo  "   �� MCC_AC � mcc_map ............... �""''mcc_map'""�"
$        echo  "   �� MCC_AC � nice_mapper ........... �""''nice_mapper'""�"
$        echo  "   �� MCC_AC � nice_collector ........ �""''nice_collector'""�"
$        echo  "   �� MCC_AC � REGfile is "      , REGfile
$        echo  "   �� MCC_AC � DEREGfile is "    , DEREGfile
$	 if Topology_Type .EQS. ip_topology
$	 then
$               echo  "   �� MCC_AC � snmpmap ............... �""''snmpmap'""�"
$               echo  "   �� MCC_AC � mcc_makeconfig.com .... �""''makeconfig'""�"
$               echo  "   �� MCC_AC � data_file is "    , data_file
$               echo  "   �� MCC_AC � EXfile is "       , EXfile
$               echo  "   �� MCC_AC � DBfile is "       , DBfile
$               echo  "   �� MCC_AC � EGfile is "       , EGfile
$               echo  "   �� MCC_AC � AUTOfile is "     , AUTOfile
$               echo  "   �� MCC_AC � mcc_ac_edt_init.dat ... �""''EDTcommands'""�"
$	 endif
$        echo  ""
$        echo  ""
$    ENDIF
$!
$ return
$!=============================================================================
$!
$!=============================================================================
$ !------------------
$  do_clean_up:
$ !------------------
$ 	set_message_off
$ 	deassign sys$output
$!
$       CLOSE     snmp_prefix_file
$       CLOSE     node4_prefix_file
$       CLOSE     domain_prefix_file
$	CLOSE     rep_data_file
$	CLOSE     ns_data_file
$!
$       if f$search("sys$scratch:mcc$$_ac_'Topology_Type'_*.tmp;") .nes. "" then -
		delete/noconfirm/nolog    sys$scratch:mcc$$_ac_'Topology_Type'_*.tmp;*
$ 	set_message_on
$	return
$!=============================================================================
$!
$!=============================================================================
$!
$!    S C R I P T    S T A R T
$!
$!=============================================================================
$!
$ BEGIN:
$!
$	GOSUB print_intro
$!
$	GOSUB check_prefixes
$!
$	GOSUB get_domain_name
$!
$	GOSUB get_top_directory
$!
$	GOSUB set_working_directory
$!
$	GOSUB display_domain_and_dir_info
$!
$	GOSUB ask_copy_map_files
$!
$	GOSUB get_autoconfig_option
$!
$	GOSUB do_autoconfig
$!
$!  Delete files only if not debugging.
$!
$	IF F$TRNLNM("MCC_AC_UTIL_LOG") .NES. "1" .AND. -
	   F$TRNLNM("MCC_AC_UTIL_LOG") .NES. "2" THEN GOSUB delete_files
$!
$	GOSUB files_created
$!
$	GOSUB quitscript_with_good_status
$!
$       EXIT
$!============================================================================
$!
$!----------------------------------------------------------------------------
$!  Abort exit
$!----------------------------------------------------------------------------
$!
$ ABORT_EXIT:
$!
$	echo ""
$	echo "        ''product_name' ABORTED by user."
$	echo ""
$ 	echo "        Warning:  ''product_name' data files"
$	echo "                  may be corrupt."
$ 	GOSUB quitscript_with_good_status
$	EXIT
$!
$!----------------------------------------------------------------------------
$!  Error exit
$!----------------------------------------------------------------------------
$!
$ ERROR_EXIT:
$!
$	echo ""
$	echo "        Error:  An error has occurred."
$	echo ""
$ 	echo "        Warning:  ''product_name' data files"
$	echo "                  may be corrupt."
$ !--------------------
$ no_msg_error_exit:
$ !--------------------
$ 	GOSUB quitscript_with_bad_status
$	EXIT
$!
$!=============================================================================
$!
$!    S C R I P T    E N D
$!
$!=============================================================================
 |