?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE CM : Job Template Deadstart', ??
MODULE cmm$job_template_deadstart;
?? RIGHT := 110 ??

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc clc$standard_file_names
*copyc clt$command_table
*copyc clt$function_processor_table
*copyc cmc$logical_conf_dev_file_name
*copyc cmc$logical_unit_constants
*copyc cme$access_device_files
*copyc cme$job_template_deadstart
*copyc cme$logical_configuration_mgr
*copyc cme$logical_configuration_utl
*copyc cmc$physical_conf_dev_file_name
*copyc cme$physical_configuration_mgr
*copyc cme$reserve_element
*copyc cml$ms_volume_initialization
*copyc cmt$cpu_element_definition
*copyc cmt$element_capability
*copyc cmt$element_information
*copyc cmt$lcu_lock_control
*copyc dmt$active_volume_table_index
*copyc dmt$error_condition_codes
*copyc dst$log_ms_volume_init
*copyc nat$network_descriptor
*copyc ofe$error_codes
*copyc oss$job_paged_literal
*copyc oss$mainframe_paged_literal
*copyc oss$task_private
*copyc oss$task_shared
*copyc ost$caller_identifier
*copyc rmd$volume_declarations
*copyc rmt$device_class
*copyc stt$number_of_members
*copyc stt$volume_info
*copyc stt$volume_list
?? POP ??
*copyc amp$close
*copyc amp$open
*copyc amp$put_next
*copyc amp$return
*copyc avp$configuration_administrator
*copyc avp$capabilities_active_any
*copyc avp$removable_media_operator
*copyc avp$system_displays
*copyc avp$system_operator
*copyc clp$trimmed_string_size
*copyc cmp$get_controller_type
*copyc cmp$get_cpu_element_r1
*copyc cmp$get_element_name_via_lun
*copyc cmp$get_element_definition
*copyc cmp$get_iou_definition
*copyc cmp$get_logical_unit_number
*copyc cmp$get_logical_unit_state
*copyc cmp$get_mainframe_element
*copyc cmp$get_unit_type
*copyc cmp$lock_set_by_task
*copyc cmp$manage_lcu_lock
*copyc cmp$pc_get_element
*copyc cmp$pc_get_logical_unit
*copyc cmp$process_cpu_state_change_r1
*copyc dmp$process_das_restore
*copyc cmp$search_peripheral_table
*copyc dmp$change_volume_attributes
*copyc dmp$activate_volume
*copyc dmp$add_class_to_volume
*copyc dmp$add_to_sorted_dfl
*copyc dmp$get_logical_attributes
*copyc dmp$get_logical_unit_number
*copyc dmp$get_physical_attributes
*copyc dmp$get_volume_attributes
*copyc dmp$initialize_ms_volume
*copyc dmp$process_force_format
*copyc dmp$volume_online
*copyc dsp$log_system_message
*copyc fsp$copy_file
*copyc osp$append_status_parameter
*copyc i#call_monitor
*copyc osp$append_status_parameter
*copyc osp$begin_system_activity
*copyc osp$end_system_activity
*copyc osp$format_message
*copyc osp$set_status_abnormal
*copyc osp$set_status_condition
*copyc pmp$get_mainframe_id
*copyc pmp$get_unique_name
*copyc stp$get_active_volume_list
?? EJECT ??
*copyc tmt$rb_update_job_task_enviro
*copyc cmv$controller_data
*copyc cmv$logical_unit_table
*copyc cmv$parity_protected_units
*copyc cmv$peripheral_element_table
*copyc cmv$physical_configuration
*copyc cmv$state_info_table
*copyc dmv$active_volume_table
*copyc dmv$system_device_information
*copyc mtv$cst0
*copyc osv$deadstart_phase
*copyc osv$cpus_logically_on
*copyc osv$cpus_physically_configured
*copyc osv$task_private_heap
?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Declared by This Module', EJECT ??
  TYPE
    cmt$mass_storage_volume = RECORD
      recorded_vsn: rmt$recorded_vsn,
      class: dmt$class,
      lun: iot$logical_unit,
      on_and_enabled: boolean,
      changed: boolean,
      write_status: ost$status,
    RECEND;

  VAR
    cmv$error_count: [XDCL, #GATE, oss$task_private] integer := 0,
    cmv$lcu_command_list: [XDCL, #GATE] ^clt$command_table := NIL,
    cmv$lcu_function_list: [XDCL, #GATE] ^clt$function_processor_table := NIL,
    cmv$network_descriptor_p: [XDCL, #GATE, oss$task_private] ^nat$network_descriptor := NIL,
    cmv$semantic_error_file_name: amt$local_file_name,
    cmv$semantic_fid: amt$file_identifier,
    cmv$syntax_error_file_name: amt$local_file_name,
    cmv$syntax_fid: amt$file_identifier;

?? OLDTITLE ??
?? NEWTITLE := 'cmp$hide_commands', EJECT ??

{ PURPOSE:
{   This procedure is used to hide commands that the user would not be able to use because of the user's
{   authority.
{ NOTES:
{   Any form of the command name may be passed to this routine and all forms of that command will be hidden.

    PROCEDURE [XDCL, #GATE] cmp$hide_commands
      (lcu_command_list: ^clt$command_table;
       lcu_function_list: ^clt$function_processor_table);

      VAR
        configuration_administrator: boolean,
        i: integer,
        removable_media_operation: boolean,
        system_displays: boolean,
        system_operation: boolean;

?? NEWTITLE := 'change_command_availability', EJECT ??

{ PURPOSE:
{   This procedure changes the availability entry for the specified command.
{ NOTES:
{   Any form of the command name may be passed to this routine and all forms of that command will be hidden.

      PROCEDURE change_command_availability
        (    command_name: string ( * <= osc$max_name_size);
             availability: clt$named_entry_availability;
         VAR command_table: ^clt$command_table);

        VAR
          command_ordinal: clt$named_entry_ordinal,
          index: integer;

      /find_command_ordinal/
        BEGIN
          FOR index := LOWERBOUND (command_table^) TO UPPERBOUND (command_table^) DO
            IF command_table^ [index].name = command_name THEN
              command_ordinal := command_table^ [index].ordinal;
              EXIT /find_command_ordinal/;
            IFEND;
          FOREND;
          RETURN;
        END /find_command_ordinal/;

        FOR index := LOWERBOUND (command_table^) TO UPPERBOUND (command_table^) DO
          IF command_table^ [index].ordinal = command_ordinal THEN
            command_table^ [index].availability := availability;
          IFEND;
        FOREND;

      PROCEND change_command_availability;
?? OLDTITLE ??
?? EJECT ??
      IF cmv$lcu_command_list = NIL THEN
        ALLOCATE cmv$lcu_command_list: [LOWERBOUND (lcu_command_list^) ..
              UPPERBOUND (lcu_command_list^)] IN osv$task_private_heap^;
        FOR i := LOWERBOUND (lcu_command_list^) TO UPPERBOUND (lcu_command_list^) DO
          cmv$lcu_command_list^ [i] := lcu_command_list^ [i];
        FOREND;
      IFEND;
      IF cmv$lcu_function_list = NIL THEN
        ALLOCATE cmv$lcu_function_list: [LOWERBOUND (lcu_function_list^) ..
              UPPERBOUND (lcu_function_list^)] IN osv$task_private_heap^;
        FOR i := LOWERBOUND (lcu_function_list^) TO UPPERBOUND (lcu_function_list^) DO
          cmv$lcu_function_list^ [i] := lcu_function_list^ [i];
        FOREND;
      IFEND;

      configuration_administrator := avp$configuration_administrator ();
      removable_media_operation := avp$removable_media_operator ();
      system_displays := avp$system_displays ();
      system_operation := avp$system_operator ();

{ Hide the commands that the user would not be able to use anyway.

      IF configuration_administrator THEN
        RETURN; {All commands are available to configuration administration user}
      IFEND;

      IF system_displays OR removable_media_operation OR
              system_operation THEN
        change_command_availability ('ADD_VOLUME_TO_SET', clc$hidden_entry, cmv$lcu_command_list);
        change_command_availability ('CHANGE_MS_CLASS', clc$hidden_entry, cmv$lcu_command_list);
        change_command_availability ('CHANGE_MS_VOLUME', clc$hidden_entry, cmv$lcu_command_list);
        change_command_availability ('CREATE_SET', clc$hidden_entry, cmv$lcu_command_list);
        change_command_availability ('DEFINE_MS_FLAW', clc$hidden_entry, cmv$lcu_command_list);
        change_command_availability ('INITIALIZE_MS_VOLUME', clc$hidden_entry, cmv$lcu_command_list);
        change_command_availability ('INSTALL_NETWORK_CONFIGURATION', clc$hidden_entry,
             cmv$lcu_command_list);
        change_command_availability ('REMOVE_MS_FLAW', clc$hidden_entry, cmv$lcu_command_list);

        IF NOT (removable_media_operation OR system_operation) THEN
          change_command_availability ('CHANGE_ELEMENT_STATE', clc$hidden_entry, cmv$lcu_command_list);
        IFEND;
        RETURN;
      IFEND;

 { If control gets here user is not validated for any SOU capability.

      change_command_availability ('ADD_VOLUME_TO_SET', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('CHANGE_ELEMENT_STATE', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('CHANGE_MS_CLASS', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('CHANGE_MS_VOLUME', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('CREATE_SET', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('DEFINE_MS_FLAW', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('DISPLAY_MAINFRAME_CONFIGURATION', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('DISPLAY_MS_CLASS', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('DISPLAY_MS_FLAW', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('DISPLAY_MS_VOLUME', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('DISPLAY_NETWORK_CONFIGURATION', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('DISPLAY_PROCESSOR_STATE', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('INITIALIZE_MS_VOLUME', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('INSTALL_NETWORK_CONFIGURATION', clc$hidden_entry, cmv$lcu_command_list);
      change_command_availability ('REMOVE_MS_FLAW', clc$hidden_entry, cmv$lcu_command_list);

      IF cmv$lcu_function_list <> NIL THEN
        FREE cmv$lcu_function_list IN osv$task_private_heap^;
        cmv$lcu_function_list := NIL;
      IFEND;

    PROCEND cmp$hide_commands;
?? OLDTITLE ??
?? NEWTITLE := '   cmp$free_command_list', EJECT ??

{ PURPOSE:
{   This procedure frees command list space upon exiting LCU.

   PROCEDURE [XDCL, #GATE] cmp$free_command_list;
     IF cmv$lcu_command_list <> NIL THEN
       FREE cmv$lcu_command_list IN osv$task_private_heap^;
     IFEND;
     IF cmv$lcu_function_list <> NIL THEN
       FREE cmv$lcu_function_list IN osv$task_private_heap^;
     IFEND;
  PROCEND cmp$free_command_list;
?? OLDTITLE ??
?? NEWTITLE := 'CMP$MANAGE_LOCK_R3', EJECT ??

{ PURPOSE :
{   Ring 3 routine to set and clear lock for serialization of LCU subcommands.

  PROCEDURE [XDCL, #GATE] cmp$manage_lock_r3
    (    lock_type: cmt$lcu_lock_type;
         lock_operation: cmt$lcu_lock_operation;
     VAR lock_control: cmt$lcu_lock_control;
     VAR status: ost$status);

    VAR
      control_p: ^cmt$lcu_lock_type_control,
      lock_processed_by_this_request: boolean;

    IF NOT avp$capabilities_active_any ($avt$conditional_capabilities
          [avc$cc_configuration_admin, avc$cc_removable_media_operator, avc$cc_system_operator]) THEN
      osp$set_status_abnormal (cmc$configuration_management_id, cme$lcm_ring_validation_error,
            'CMP$MANAGE_LOCK_R3', status);
      RETURN; {----->
    IFEND;

{We always try to set/clear the lock (even when control sais that we did already). It's
{unlikly but something else could have change it (ex. CM or ST)

    control_p := ^lock_control.controls [lock_type];
    CASE lock_operation OF
    = cmc$llo_set_lock =
      cmp$manage_lcu_lock (lock_type, lock_operation, lock_processed_by_this_request, status);
      control_p^.lock_set := status.normal;
      control_p^.lock_set_by_this_instance := lock_processed_by_this_request;
      IF status.normal AND (lock_control.system_activity_set = FALSE) THEN
        osp$begin_system_activity;
        lock_control.system_activity_set := TRUE;
      IFEND;

    = cmc$llo_end_system_activity =
      IF lock_control.system_activity_set THEN
        osp$end_system_activity;
        lock_control.system_activity_set := FALSE;
      IFEND;

    = cmc$llo_clear_lock =
      control_p^.lock_set_by_this_instance := FALSE;
      IF control_p^.lock_set THEN
        cmp$manage_lcu_lock (lock_type, lock_operation, lock_processed_by_this_request, status);
        control_p^.lock_set := FALSE;
      IFEND;

      IF lock_control.system_activity_set
{   } AND (NOT lock_control.controls [cmc$configuration_administrator].lock_set)
{   } AND (NOT lock_control.controls [cmc$removable_media_operation].lock_set) then

        osp$end_system_activity;
        lock_control.system_activity_set := FALSE;
      IFEND;
    CASEND;

  PROCEND cmp$manage_lock_r3;
?? OLDTITLE ??
?? NEWTITLE := '   cmp$lock_set_by_current_task', EJECT ??

  FUNCTION [XDCL, #GATE, UNSAFE] cmp$lock_set_by_current_task (
      lock_type: cmt$lcu_lock_type): BOOLEAN;

     cmp$lock_set_by_current_task := cmp$lock_set_by_task (lock_type);

  FUNCEND cmp$lock_set_by_current_task;

?? OLDTITLE ??
?? NEWTITLE := '   cmp$determine_tape_element', EJECT ??

{ PURPOSE:
{   This procedure determines whether or not the given element
{   descriptor is a tape element.

  PROCEDURE [XDCL, #GATE] cmp$determine_tape_element
    (    element: cmt$element_descriptor;
     VAR tape_element: boolean);

    VAR
      element_p: ^cmt$element_definition,
      controller_type: cmt$controller_type,
      definition: cmt$element_definition,
      dummy_iou: cmt$element_name,
      found: boolean,
      io_unit_type: iot$unit_type,
      pen: cmt$physical_equipment_number,
      pun: cmt$physical_unit_number,
      status: ost$status,
      unit_class: cmt$unit_class,
      unit_type: cmt$unit_type;

    tape_element := FALSE;
    cmp$get_element_definition (element, definition, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    CASE definition.element_type OF
    = cmc$data_channel_element =
      FOR pen := LOWERVALUE (cmt$physical_equipment_number) TO UPPERVALUE (cmt$physical_equipment_number) DO
        IF definition.data_channel.connection.equipment [pen].configured THEN
          cmp$pc_get_element (definition.data_channel.connection.equipment [pen].element_name,
                   dummy_iou, element_p, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;

          cmp$get_controller_type (element_p^.product_id, controller_type, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;

          tape_element := (controller_type = cmc$mt5698_xx)
{                    } OR (controller_type = cmc$mt5680_xx)
{                    } OR (controller_type = cmc$mt7021_3x)
{                    } OR (controller_type = cmc$mt7021_4x)
{                    } OR (controller_type = cmc$mt7221_1)
{                    } OR (controller_type = cmc$mt7221_2_s0)
{                    } OR (controller_type = cmc$mt698_xx);

          RETURN;
        IFEND;
      FOREND;
    = cmc$controller_element =
      cmp$get_controller_type (definition.product_id, controller_type, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      tape_element := (controller_type = cmc$mt5698_xx)
{                } OR (controller_type = cmc$mt5680_xx)
{                } OR (controller_type = cmc$mt7021_3x)
{                } OR (controller_type = cmc$mt7021_4x)
{                } OR (controller_type = cmc$mt7221_1)
{                } OR (controller_type = cmc$mt7221_2_s0)
{                } OR (controller_type = cmc$mt698_xx);

    = cmc$storage_device_element =
      cmp$get_unit_type (definition.product_id, unit_type, io_unit_type, unit_class, found);
      tape_element := unit_class = cmc$magnetic_tape_unit;

    ELSE
      ;
    CASEND;

  PROCEND cmp$determine_tape_element;
?? OLDTITLE ??
?? NEWTITLE := '    cmp$open_scratch_err_file',EJECT ??

   PROCEDURE [XDCL, #GATE] cmp$open_scratch_err_file (
       VAR status: ost$status);

     pmp$get_unique_name (cmv$syntax_error_file_name, status);
     IF NOT status.normal THEN
       RETURN;
     IFEND;

     amp$open (cmv$syntax_error_file_name, amc$record, NIL,
          cmv$syntax_fid, status);
     IF NOT status.normal THEN
       RETURN;
     IFEND;
     pmp$get_unique_name (cmv$semantic_error_file_name, status);
     IF NOT status.normal THEN
       RETURN;
     IFEND;
     amp$open (cmv$semantic_error_file_name, amc$record, NIL,
          cmv$semantic_fid, status);
     IF NOT status.normal THEN
       RETURN;
     IFEND;

  PROCEND cmp$open_scratch_err_file;

?? OLDTITLE ??
?? NEWTITLE := '    cmp$echo_command ',EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$echo_command
    (    command_line: ost$string;
     VAR status: ost$status);

    VAR
      byte_address: amt$file_byte_address;

    amp$put_next (cmv$syntax_fid, #LOC (command_line.value), command_line.size, byte_address, status);

  PROCEND cmp$echo_command;
?? OLDTITLE ??
?? NEWTITLE := '    cmp$echo_errors', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$echo_errors
    (    syntax_error: boolean;
         status_echoed: ost$status);

    VAR
      byte_address: amt$file_byte_address,
      length: integer,
      line_count: ost$status_message_line_count,
      local_status: ost$status,
      output_str: string (255),
      p_line_count: ^ost$status_message_line_count,
      p_line_size: ^ost$status_message_line_size,
      p_message: ^ost$status_message,
      p_message_line: ^string ( * ),
      str: ost$string;

      cmv$error_count := cmv$error_count + 1;
      PUSH p_message;
      osp$format_message (status_echoed, osc$full_message_level, osc$max_string_size,
            p_message^, local_status);
      IF NOT local_status.normal THEN
        RETURN;
      IFEND;
      RESET p_message;
      NEXT p_line_count IN p_message;
      FOR line_count := 1 TO p_line_count^ DO
        NEXT p_line_size IN p_message;
        NEXT p_message_line: [p_line_size^] IN p_message;
        IF syntax_error THEN

          amp$put_next (cmv$syntax_fid, #LOC (p_message_line^), #SIZE(p_message_line^),
            byte_address, local_status);
        ELSE
          amp$put_next (cmv$semantic_fid, #LOC (p_message_line^), #SIZE(p_message_line^),
            byte_address, local_status);

        IFEND;
        IF NOT local_status.normal THEN
          RETURN;
        IFEND;

      FOREND;

  PROCEND cmp$echo_errors;

?? OLDTITLE ??
?? NEWTITLE := '    cmp$generate_error_listing',EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$generate_error_listing
    (    error_file_name: amt$local_file_name;
     VAR status: ost$status);

    VAR
      creation_attr: array [1 .. 1] of fst$file_cycle_attribute,
      local_status: ost$status,
      temp_error_file: string (osc$max_name_size + 5);

    status.normal := TRUE;
    amp$close (cmv$syntax_fid, local_status);
    amp$close (cmv$semantic_fid, local_status);
    creation_attr [1].selector := fsc$ring_attributes;
    creation_attr [1].ring_attributes.r1 := osc$user_ring;
    creation_attr [1].ring_attributes.r2 := osc$user_ring;
    creation_attr [1].ring_attributes.r3 := osc$user_ring;
    fsp$copy_file (cmv$syntax_error_file_name, error_file_name, NIL, ^creation_attr,
             ^creation_attr,  status);
    IF NOT status.normal THEN
      IF status.condition = fse$empty_input_file THEN
        status.normal := TRUE;
      ELSE
        RETURN;
      IFEND;
    IFEND;
    temp_error_file := error_file_name;
    temp_error_file (clp$trimmed_string_size (error_file_name)+1, *) := '.$EOI';
    fsp$copy_file (cmv$semantic_error_file_name, temp_error_file, NIL, ^creation_attr,
        ^creation_attr, status);
    IF NOT status.normal THEN
      IF status.condition = fse$empty_input_file THEN
        status.normal := TRUE;
      ELSE
        RETURN;
      IFEND;
    IFEND;

  PROCEND cmp$generate_error_listing;
?? OLDTITLE ??
?? NEWTITLE := '    cmp$clean_up_error_count',EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$clean_up_error_count;

      VAR
        local_status: ost$status;

      amp$close (cmv$syntax_fid, local_status);
      amp$close (cmv$semantic_fid, local_status);
      amp$return (cmv$syntax_error_file_name, local_status);
      amp$return (cmv$semantic_error_file_name, local_status);

      cmv$error_count := 0;

  PROCEND cmp$clean_up_error_count;
?? OLDTITLE ??
?? NEWTITLE := '    cmp$clean_up_network_list', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$clean_up_network_list
    (VAR status: ost$status);

    VAR
      next_pointer: ^nat$network_descriptor,
      pointer: ^nat$network_descriptor;

    status.normal := TRUE;
    IF cmv$network_descriptor_p = NIL THEN
      RETURN;
    IFEND;
    pointer := cmv$network_descriptor_p;

{ Go thru the list and free all pointers allocated in task private heap }

    WHILE pointer <> NIL DO
      next_pointer := pointer^.next_descriptor;

      FREE pointer IN osv$task_private_heap^;
      pointer := next_pointer;
    WHILEND;
    cmv$network_descriptor_p := NIL;

  PROCEND cmp$clean_up_network_list;
?? OLDTITLE ??
?? NEWTITLE := '    cmp$form_network_list', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$form_network_list
    (VAR network_descriptor: ^nat$network_descriptor;
     VAR status: ost$status);

      VAR
        cpn: cmt$communications_port_number,
        current_p: ^nat$network_descriptor,
        element_descriptor: cmt$element_descriptor,
        element_reservation: cmt$element_reservation,
        element_type: cmt$element_type,
        iou_definition: cmt$iou_definition,
        iou_name: cmt$element_name,
        mainframe_id: pmt$mainframe_id,
        pc_index_1: integer,
        pc_index_2: integer,
        peripheral_index: integer,
        previous_p: ^^nat$network_descriptor,
        temp_pointer: ^nat$network_descriptor;

  { At this time there is no user heap in ring 11.  Therefore this procedure must be in ring 3 in order to
  { keep a head of list global.  After a call to INSTALL_NETWORK_CONFIGURATION the list must be cleared.

      ALLOCATE temp_pointer IN osv$task_private_heap^;

  /main_program/
    BEGIN
      IF network_descriptor <> NIL THEN
        temp_pointer^ := network_descriptor^;
        IF network_descriptor^.kind = nac$network_device THEN

{ Verify element names in network_descriptor if they are in peripheral table.

          iou_name := 'IOU0';
          cmp$get_element_type (network_descriptor^.access.element, iou_name, element_type, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;
          iou_name := 'IOU0';
          cmp$get_iou_definition (iou_name, iou_definition, status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;

          element_descriptor.element_type := element_type;
          IF element_type = cmc$data_channel_element THEN
            element_descriptor.channel_descriptor.iou := iou_name;
            element_descriptor.channel_descriptor.name := network_descriptor^.access.element;
          ELSE
            element_descriptor.peripheral_descriptor.element_name := network_descriptor^.access.element;
          IFEND;
          cmp$search_peripheral_table (element_descriptor, element_reservation, FALSE, peripheral_index,
                status);
          IF NOT status.normal THEN
            RETURN;
          IFEND;

{ Should return abnormal status if channel and channel_address NOT found.

          CASE element_type OF

          = cmc$channel_adapter_element =
            IF (cmv$peripheral_element_table.
                pointer ^[peripheral_index].product_id.product_number = ' $2629') AND
                (cmv$peripheral_element_table.
                     pointer ^[peripheral_index].product_id.model_number = '2   ') THEN
              IF temp_pointer^.system_identifier <> 0 THEN
                temp_pointer^.device_type := nac$ica_2;
                temp_pointer^.driver_name := 'ICAD';
              ELSE
                osp$set_status_condition (cme$jtd_ica2_requires_system_id, status);
                EXIT /main_program/;
              IFEND;
            ELSE
              osp$set_status_abnormal (cmc$configuration_management_id,
                   cme$jtd_invalid_element_type, network_descriptor^.access.element, status);
              EXIT /main_program/;
            IFEND;

            /loop_ica/
            FOR pc_index_1 := 1 TO UPPERBOUND (cmv$physical_configuration^) DO
              IF (cmv$physical_configuration^ [pc_index_1].element_type = cmc$channel_adapter_element)
                 AND (cmv$physical_configuration^ [pc_index_1].element_name =
                          element_descriptor.peripheral_descriptor.element_name) THEN
                IF cmv$physical_configuration^ [pc_index_1].
                    channel_adapter.connection.channel.configured THEN
                  FOR pc_index_2 := 1 TO UPPERBOUND (cmv$physical_configuration^) DO
                    IF (cmv$physical_configuration^ [pc_index_2].element_type = cmc$data_channel_element) AND
                       (cmv$physical_configuration^ [pc_index_1].channel_adapter.connection.
                          channel.iou = cmv$physical_configuration^ [pc_index_2].data_channel.iou) AND
                        (cmv$physical_configuration^ [pc_index_1].channel_adapter.connection.
                          channel.element_name = cmv$physical_configuration^ [pc_index_2].element_name) THEN
                      temp_pointer^.access.channel := cmv$physical_configuration^ [pc_index_2].
                           data_channel.ordinal;
                      temp_pointer^.access.channel_address :=
                        cmv$physical_configuration^ [pc_index_1].channel_adapter.physical_equipment_number;
                      EXIT /loop_ica/;
                    IFEND;
                  FOREND;
                IFEND;
              IFEND;
            FOREND /loop_ica/;

          = cmc$communications_element =
            IF (cmv$peripheral_element_table.
                      pointer ^[peripheral_index].product_id.product_number = ' $2620') OR
                (cmv$peripheral_element_table.
                   pointer ^[peripheral_index].product_id.product_number = ' $2621') THEN
              temp_pointer^.device_type := nac$di;
              temp_pointer^.driver_name := 'NETW';
            ELSEIF (cmv$peripheral_element_table.
                      pointer ^[peripheral_index].product_id.product_number = ' $4000') THEN
              temp_pointer^.device_type := nac$expresslink;
              IF iou_definition.kind = dsc$imn_i0_5x_model THEN
                temp_pointer^.driver_name := 'IVB0';
              ELSE
                temp_pointer^.driver_name := 'IVB4';
              IFEND;
            ELSE
              osp$set_status_abnormal (cmc$configuration_management_id,
                   cme$jtd_invalid_element_type, network_descriptor^.access.element, status);
              EXIT /main_program/;
            IFEND;
            IF temp_pointer^.system_identifier <> 0 THEN
              osp$set_status_condition (cme$jtd_system_id_not_allowed, status);
              EXIT /main_program/;
            IFEND;

            pmp$get_mainframe_id (mainframe_id, status);
            /loop_communications/
            FOR pc_index_1 := 1 TO UPPERBOUND (cmv$physical_configuration^) DO
              IF (cmv$physical_configuration^ [pc_index_1].element_type = cmc$communications_element)
                 AND (cmv$physical_configuration^ [pc_index_1].element_name =
                          element_descriptor.peripheral_descriptor.element_name) THEN
                FOR cpn := LOWERVALUE (cpn) TO UPPERVALUE (cpn) DO
                  IF (cmv$physical_configuration^ [pc_index_1].
                      communications_element.connection.port [cpn].configured) AND
                     (cmv$physical_configuration^ [pc_index_1].
                      communications_element.connection.port [cpn].mainframe_ownership = mainframe_id) THEN
                    FOR pc_index_2 := 1 TO UPPERBOUND (cmv$physical_configuration^) DO
                      IF (cmv$physical_configuration^ [pc_index_2].
                          element_type = cmc$data_channel_element) AND
                         (cmv$physical_configuration^ [pc_index_1].communications_element.connection.port
                            [cpn].iou = cmv$physical_configuration^ [pc_index_2].data_channel.iou) AND
                          (cmv$physical_configuration^ [pc_index_1].communications_element.connection.port
                            [cpn].element_name = cmv$physical_configuration^ [pc_index_2].element_name) THEN
                        temp_pointer^.access.channel := cmv$physical_configuration^ [pc_index_2].
                              data_channel.ordinal;
                        temp_pointer^.access.channel_address := cmv$physical_configuration^
                          [pc_index_1].communications_element.physical_equipment_number;
                        EXIT /loop_communications/;
                      IFEND;
                    FOREND;
                  IFEND;
                FOREND;
              IFEND;
            FOREND /loop_communications/;
          ELSE
            osp$set_status_abnormal (cmc$configuration_management_id,
                  cme$jtd_invalid_element_type, network_descriptor^.access.element, status);
            EXIT /main_program/;
          CASEND;
        ELSEIF network_descriptor^.kind = nac$define_tcpip_host THEN
          ALLOCATE temp_pointer^.tcpip.host_name: [#SIZE (network_descriptor^.tcpip.host_name^)] IN
                osv$task_private_heap^;
          temp_pointer^.tcpip.host_name^ := network_descriptor^.tcpip.host_name^;

        IFEND;

        temp_pointer^.next_descriptor := cmv$network_descriptor_p;
        cmv$network_descriptor_p := temp_pointer;
      ELSE
        osp$set_status_abnormal (cmc$configuration_management_id, cme$jtd_nil_network_descriptor,
          'cmp$form_network_list', status);
      IFEND;
    END /main_program/;

  PROCEND cmp$form_network_list;
?? OLDTITLE ??
?? NEWTITLE := '    cmp$process_cpu_state_change', EJECT ??

*copyc cmh$process_cpu_state_change
  PROCEDURE [XDCL, #GATE] cmp$process_cpu_state_change
    (    processor_id: ost$processor_id;
         current_state: cmt$element_state;
         new_state: cmt$element_state;
     VAR status: ost$status);

    VAR
      caller_identifier: ost$caller_identifier,
      cst_p: ^ost$cpu_state_table,
      state_translation_table: [STATIC, READ, oss$job_paged_literal] array [cmt$element_state] of string (4)
            := ['  ON', ' OFF', 'DOWN'];

    #caller_id (caller_identifier);
    status.normal := TRUE;
    IF  NOT (avp$configuration_administrator () OR avp$system_operator ()
             OR (caller_identifier.ring <= 6)) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration or system_operation'
          , status);
      RETURN;
    IFEND;

    cst_p := ^mtv$cst0 [processor_id];
    IF cst_p^.processor_state <> current_state THEN
      osp$set_status_abnormal (cmc$configuration_management_id, cme$state_changed_in_interim,
            state_translation_table [current_state], status);
      osp$append_status_parameter (osc$status_parameter_delimiter, state_translation_table
            [cst_p^.processor_state], status);
      RETURN;
    IFEND;

    IF cst_p^.processor_state = cmc$off THEN

{ A state change from OFF to any other state is not supported, and such a state change is detected in the
{ caller to this procedure.  This code is present to prevent a malicious user from performing a state change
{ using this procedure as an entry point.

      osp$set_status_abnormal (cmc$configuration_management_id, cme$lcm_model_cant_change_state,
            state_translation_table [current_state], status);
      osp$append_status_parameter (osc$status_parameter_delimiter, state_translation_table [new_state],
            status);
      RETURN;
    IFEND;

    IF (new_state <> cmc$on) AND (osv$cpus_logically_on < 2) THEN
      osp$set_status_abnormal (cmc$configuration_management_id, cme$change_produces_interrupt,
            state_translation_table [current_state], status);
      osp$append_status_parameter (osc$status_parameter_delimiter, state_translation_table
            [new_state], status);
      RETURN;
    IFEND;

    cmp$process_cpu_state_change_r1 (processor_id, new_state, status);

  PROCEND cmp$process_cpu_state_change;
?? OLDTITLE ??
?? NEWTITLE := '    cmp$enable_production_r3', EJECT ??
{
{ PURPOSE:
{   This procedure makes a monitor call to enable production on a reinstated CPU.  Until this command is
{   entered, the CPU will not be used by any existing job, including those jobs which may have explicitly
{   requested the use of the reinstated CPU previous to its deconfiguration/reconfiguration.
{
  PROCEDURE [XDCL, #GATE] cmp$enable_production_r3
    (VAR status: ost$status);

    VAR
      caller_identifier: ost$caller_identifier,
      request_block: tmt$rb_update_job_task_enviro;

    status.normal := TRUE;
    #caller_id (caller_identifier);
    IF NOT (avp$configuration_administrator () OR avp$system_operator ()
             OR (caller_identifier.ring <= 6)) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration or system_operation',
            status);
      RETURN;
    IFEND;

{ Set up and make the monitor call which enables production on the reinstated CPU.

    request_block.reqcode := syc$rc_update_job_task_enviro;
    request_block.status.normal := TRUE;
    request_block.subcode := tmc$ujte_update_cpu_selections;
    i#call_monitor (#LOC (request_block), #SIZE (request_block));

  PROCEND cmp$enable_production_r3;
?? OLDTITLE ??
?? NEWTITLE := '    FUNCTION cmp$cpus_physically_configured', EJECT ??
{
{ PURPOSE:
{   This function provides a ring 3 interface to access the ring 1 variable OSV$CPUS_PHYSICALLY_CONFIGURED.
{
  FUNCTION [XDCL, #GATE] cmp$cpus_physically_configured: ost$processor_id;

    cmp$cpus_physically_configured := osv$cpus_physically_configured;

  FUNCEND cmp$cpus_physically_configured;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$get_unit_number_via_vsn', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_unit_number_via_vsn
    (    recorded_vsn: rmt$recorded_vsn;
     VAR logical_unit_number: iot$logical_unit;
     VAR status: ost$status);

    dmp$get_logical_unit_number (recorded_vsn, logical_unit_number, status);

  PROCEND cmp$get_unit_number_via_vsn;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$activate_volume', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$activate_volume
    (    logical_unit_number: iot$logical_unit;
     VAR status: ost$status);

    VAR
      lun: iot$logical_unit;

    IF (NOT avp$configuration_administrator ()) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration', status);
      RETURN;
    IFEND;
    lun := logical_unit_number;
    status.normal := TRUE;
    dmp$activate_volume (lun, status);
    IF status.normal THEN
      dmp$add_to_sorted_dfl (lun, status);
    IFEND;

  PROCEND cmp$activate_volume;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$process_force_format', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$process_force_format
    (    product_id: cmt$product_identification;
         element: cmt$element_name;
         logical_unit_number: iot$logical_unit;
         force_format: boolean;
     VAR status: ost$status);

    VAR
      found: boolean,
      io_unit_type: iot$unit_type,
      unit_class: cmt$unit_class,
      unit_type: cmt$unit_type;

{ Valdate user for 'configuration_administrator' capability.
    IF (NOT avp$configuration_administrator ()) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration', status);
      RETURN;
    IFEND;

{ Validate that the unit type is valid for this command and call processor.
    cmp$get_unit_type (product_id, unit_type, io_unit_type, unit_class, found);
    IF unit_type in cmv$parity_protected_units THEN
      dmp$process_force_format (logical_unit_number, force_format, status);
    ELSE
      osp$set_status_abnormal (cmc$configuration_management_id, cme$lcu_invalid_unit_type, element, status);
    IFEND;

  PROCEND cmp$process_force_format;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$process_das_restore', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$process_das_restore
    (    product_id: cmt$product_identification;
         element: cmt$element_name;
         logical_unit_number: iot$logical_unit;
     VAR status: ost$status);

    VAR
      found: boolean,
      io_unit_type: iot$unit_type,
      unit_class: cmt$unit_class,
      unit_type: cmt$unit_type;

{ Valdate user for 'configuration_administrator' capability.
    IF (NOT avp$configuration_administrator ()) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration', status);
      RETURN;
    IFEND;

{ Validate that the unit type is valid for this command and call processor.
    cmp$get_unit_type (product_id, unit_type, io_unit_type, unit_class, found);
    IF unit_type in cmv$parity_protected_units THEN
      dmp$process_das_restore (logical_unit_number, status);
    ELSE
      osp$set_status_abnormal (cmc$configuration_management_id, cme$lcu_invalid_unit_type, element, status);
    IFEND;

  PROCEND cmp$process_das_restore;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$initialize_ms_volume', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$initialize_ms_volume
    (    access_code: ost$name;
         product_id: cmt$product_identification;
         owner_id: ost$user_identification;
         p_physical_attributes: ^dmt$physical_device_attributes;
         p_logical_attributes: ^dmt$logical_device_attributes;
         p_volume_label_attributes: ^dmt$volume_label_attributes;
         logical_unit_number: iot$logical_unit;
         initialization_options: dmt$initialize_ms_vol_options;
     VAR initialize_status_info: dmt$initialize_status_info;
     VAR status: ost$status);

    VAR
      element_def: ^cmt$element_definition,
      found: boolean,
      io_unit_type: iot$unit_type,
      log_data_ptr: ^SEQ (*),
      logging_data: dst$log_ms_volume_init,
      unit_class: cmt$unit_class,
      unit_type: cmt$unit_type;

    IF (NOT avp$configuration_administrator ()) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration', status);
      RETURN;
    IFEND;

    cmp$get_unit_type (product_id, unit_type, io_unit_type, unit_class, found);
    IF (unit_class = cmc$mass_storage_unit) AND (io_unit_type <> ioc$dt_foreign_device) THEN

      dmp$initialize_ms_volume (access_code, owner_id, unit_type, p_physical_attributes,
            p_logical_attributes, p_volume_label_attributes,
            logical_unit_number, initialization_options, initialize_status_info, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      cmp$get_element_name_via_lun (logical_unit_number, logging_data.element_name, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      logging_data.recorded_vsn := p_volume_label_attributes^ [3].recorded_vsn;
      cmp$pc_get_logical_unit (logical_unit_number,  element_def, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      IF element_def^.element_type = cmc$storage_device_element THEN
        logging_data.physical_unit_number := element_def^.storage_device.physical_unit_number;
      IFEND;

      log_data_ptr := #SEQ (logging_data);
      dsp$log_system_message (cml$ms_volume_initialization, log_data_ptr, status);
    ELSE
      osp$set_status_abnormal (cmc$configuration_management_id,
          cme$jtd_unsupported_unit_class, product_id.product_number, status);
    IFEND;

  PROCEND cmp$initialize_ms_volume;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$volume_online', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$volume_online
    (    logical_unit_number: iot$logical_unit;
         p_physical_attributes: ^dmt$physical_device_attributes;
     VAR status: ost$status);

    VAR
      lun: iot$logical_unit,
      local_status: ost$status;

    IF (NOT avp$configuration_administrator ()) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration', status);
      RETURN;
    IFEND;
    lun := logical_unit_number;
    status.normal := TRUE;
    dmp$volume_online (lun, p_physical_attributes, status);

  PROCEND cmp$volume_online;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$change_volume_attributes', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$change_volume_attributes
    (    logical_unit_number: iot$logical_unit;
         p_volume_attributes: ^dmt$volume_attributes;
     VAR status: ost$status);

    IF (NOT avp$configuration_administrator ()) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration', status);
      RETURN; {----->
    IFEND;

    dmp$change_volume_attributes (logical_unit_number, p_volume_attributes, status);

  PROCEND cmp$change_volume_attributes;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$get_volume_attributes', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_volume_attributes
    (    logical_unit_number: iot$logical_unit;
     VAR volume_attribute_info: dmt$volume_attribute_info;
     VAR status: ost$status);

    VAR
      lun: iot$logical_unit,
      volume_attr_info: dmt$volume_attribute_info;

    status.normal := TRUE;
    lun := logical_unit_number;
    dmp$get_volume_attributes (lun, volume_attr_info, status);
    IF status.normal THEN
      volume_attribute_info := volume_attr_info;
    IFEND;

  PROCEND cmp$get_volume_attributes;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$get_logical_attributes', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_logical_attributes
    (    product_identification: cmt$product_identification;
     VAR p_logical_attributes: ^dmt$logical_device_attributes;
     VAR status: ost$status);

    VAR
      pid: cmt$product_identification;

    status.normal := TRUE;
    pid := product_identification;
    dmp$get_logical_attributes (pid, p_logical_attributes, status);

  PROCEND cmp$get_logical_attributes;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$get_physical_attributes', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_physical_attributes
    (    product_identification: cmt$product_identification;
     VAR p_physical_attributes: ^dmt$physical_device_attributes;
     VAR status: ost$status);

    VAR
      pid: cmt$product_identification;

    status.normal := TRUE;
    pid := product_identification;
    dmp$get_physical_attributes (pid, p_physical_attributes, status);

  PROCEND cmp$get_physical_attributes;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$get_controller_type_r3', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_controller_type_r3
    (    pid: cmt$product_identification;
     VAR controller_type: cmt$controller_type;
     VAR status: ost$status);

    VAR
      ct: cmt$controller_type,
      product_id: cmt$product_identification;

    status.normal := TRUE;
    product_id := pid;
    cmp$get_controller_type (product_id, ct, status);
    IF status.normal THEN
      controller_type := ct;
    IFEND;

  PROCEND cmp$get_controller_type_r3;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$get_element_r3', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_element_r3
    (    element_name: cmt$element_name;
         iou_name: cmt$element_name;
     VAR mainframe_element: ^cmt$element_definition;
     VAR status: ost$status);

    cmp$get_mainframe_element (element_name, iou_name, mainframe_element^, status);

  PROCEND cmp$get_element_r3;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$get_cpu_element_r3', EJECT ??

*copyc cmh$get_cpu_element_r3
  PROCEDURE [XDCL, #GATE] cmp$get_cpu_element_r3
    (    processor_id: ost$processor_id;
     VAR cpu_element: ^cmt$cpu_element_definition;
     VAR status: ost$status);

    cmp$get_cpu_element_r1 (processor_id, {update_cst =} TRUE, cpu_element^, status);

  PROCEND cmp$get_cpu_element_r3;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] cmp$get_element_type', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_element_type
    (    element_name: cmt$element_name;
         iou_name: cmt$element_name;
     VAR element_type: cmt$element_type;
     VAR status: ost$status);

    VAR
      element: cmt$element_name,
      iou: cmt$element_name,
      mainframe_element: cmt$element_definition;

    status.normal := TRUE;
    element := element_name;
    iou := iou_name;
    cmp$get_mainframe_element (element, iou, mainframe_element, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    element_type := mainframe_element.element_type;

  PROCEND cmp$get_element_type;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$GET_LOGICAL_UNIT_NUMBER_R3', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_logical_unit_number_r3
    (    element_name: cmt$element_name;
     VAR logical_unit_number: iot$logical_unit;
     VAR status: ost$status);

    VAR
      element: cmt$element_name,
      lun: iot$logical_unit;

    status.normal := TRUE;
    element := element_name;
    cmp$get_logical_unit_number (element, lun, status);
    IF status.normal THEN
      logical_unit_number := lun;
    IFEND;

  PROCEND cmp$get_logical_unit_number_r3;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$GET_SYS_DEV_REC_VSN', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_sys_dev_rec_vsn
    (VAR recorded_vsn: rmt$recorded_vsn;
     VAR status: ost$status);

    status.normal := TRUE;
    recorded_vsn := dmv$system_device_recorded_vsn;

  PROCEND cmp$get_sys_dev_rec_vsn;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] cmp$deadstart_phase', EJECT ??

  FUNCTION [XDCL, #GATE] cmp$deadstart_phase: ost$deadstart_phase;

    cmp$deadstart_phase := osv$deadstart_phase;

  FUNCEND cmp$deadstart_phase;
?? OLDTITLE ??
?? NEWTITLE := '      cmp$known_controller_id', EJECT ??

  FUNCTION [XDCL, #GATE] cmp$known_controller_id
    (    product_id: cmt$product_identification): boolean;

    VAR
      index: integer;

    cmp$known_controller_id := FALSE;

  /forloop/
    FOR index := 1 TO UPPERBOUND (cmv$controller_data_ptr^) DO

      IF product_id = cmv$controller_data_ptr^ [index].product_id THEN
        cmp$known_controller_id := TRUE;
        EXIT /forloop/;
      IFEND;

    FOREND /forloop/;

  FUNCEND cmp$known_controller_id;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$KNOWN_PRODUCT_ID', EJECT ??

  FUNCTION [XDCL, #GATE] cmp$known_product_id
    (    product_id: cmt$product_identification): boolean;

    VAR
      index: integer;

    cmp$known_product_id := FALSE;

  /forloop/
    FOR index := 1 TO UPPERBOUND (cmv$product_id_ptr^) DO

      IF product_id = cmv$product_id_ptr^ [index].product_id THEN
        cmp$known_product_id := TRUE;
        EXIT /forloop/;
      IFEND;

    FOREND /forloop/;

  FUNCEND cmp$known_product_id;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$ADD_CLASS_TO_ELEMENT', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$add_class_to_element
    (    avt_index: dmt$active_volume_table_index;
         class: dmt$class;
     VAR status: ost$status);

    VAR
      add_class: dmt$class,
      index: dmt$active_volume_table_index;

    IF (NOT avp$configuration_administrator ()) THEN
      osp$set_status_abnormal ('OF', ofe$sou_not_active, 'configuration_administration', status);
      RETURN;
    IFEND;
    status.normal := TRUE;
    index := avt_index;
    add_class := class;
    dmp$add_class_to_volume (index, add_class, status);

  PROCEND cmp$add_class_to_element;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$OBTAIN_MAX_VOLUME_INDEX', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$obtain_max_volume_index
    (VAR max_volume_index: integer);

    max_volume_index := UPPERBOUND (dmv$active_volume_table.table_p^);

  PROCEND cmp$obtain_max_volume_index;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$GET_MS_VOLUMES', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_ms_volumes
    (VAR max_ms_volumes: integer);

    VAR
      index: integer;

    max_ms_volumes := 0;
    FOR index := LOWERBOUND (dmv$active_volume_table.table_p^)
          TO UPPERBOUND (dmv$active_volume_table.table_p^) DO
      IF NOT dmv$active_volume_table.table_p^ [index].entry_available THEN
        max_ms_volumes := max_ms_volumes + 1;
      IFEND;
    FOREND

  PROCEND cmp$get_ms_volumes;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$GET_MS_VOLUME_INFO', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_ms_volume_info
    (VAR ms_volumes: array [1 .. * ] of cmt$mass_storage_volume);

    VAR
      entry_p: ^dmt$active_volume_table_entry,
      index: integer,
      volume_p: ^cmt$mass_storage_volume,
      ms_index: integer;

    ms_index := 0;
    FOR index := LOWERBOUND (dmv$active_volume_table.table_p^)
          TO UPPERBOUND (dmv$active_volume_table.table_p^) DO
      entry_p := ^dmv$active_volume_table.table_p^ [index];
      IF NOT entry_p^.entry_available THEN
        ms_index := ms_index + 1;
        IF ms_index <= UPPERBOUND (ms_volumes) THEN
          volume_p := ^ms_volumes [ms_index];
          volume_p^.recorded_vsn := entry_p^.mass_storage.recorded_vsn;
          volume_p^.class := entry_p^.mass_storage.class;
          volume_p^.lun := entry_p^.logical_unit_number;
        IFEND;
      IFEND;
    FOREND

  PROCEND cmp$get_ms_volume_info;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$OBTAIN_VOLUMES', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$obtain_volumes
    (VAR volume_list: ^stt$volume_list;
     VAR number_of_members: integer);

    VAR
      status: ost$status;

    stp$get_active_volume_list (volume_list^, number_of_members, status);

  PROCEND cmp$obtain_volumes;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$GET_PARITY_STATUS_INFO', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_parity_status_info
    (    element_name: cmt$element_name;
     VAR parity_status: iot$unit_status;
     VAR status: ost$status);

    VAR
      lun: iot$logical_unit;

    cmp$get_logical_unit_number (element_name, lun, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    parity_status := cmv$logical_unit_table ^[lun].unit_interface_table ^.unit_status;

  PROCEND cmp$get_parity_status_info;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$GET_MS_STATUS_VIA_LUN', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_ms_status_via_lun
    (    lun: iot$logical_unit;
     VAR element_status: iot$unit_status);

    element_status.disabled := cmv$logical_unit_table ^[lun].unit_interface_table ^.unit_status.disabled;

  PROCEND cmp$get_ms_status_via_lun;
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] CMP$GET_ELEMENT_STATE_VIA_LUN', EJECT ??

  PROCEDURE [XDCL, #GATE] cmp$get_element_state_via_lun
    (    logical_unit_number: iot$logical_unit;
     VAR state: cmt$element_state);

    VAR
      lun: iot$logical_unit,
      element_state: cmt$element_state;

    lun := logical_unit_number;
    cmp$get_logical_unit_state (lun, cmv$logical_unit_table, element_state);
    state := element_state;

  PROCEND cmp$get_element_state_via_lun;
?? OLDTITLE ??
MODEND cmm$job_template_deadstart;
