?? TITLE := 'Neptun Maintenance Services utility.' ??
MODULE msm$maintenance_services_utl;
?? RIGHT := 110 ??

?? NEWTITLE := 'Global Declarations Referenced By This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc oss$job_paged_literal
*copyc cmc$condition_limits
*copyc cme$logical_configuration_mgr
*copyc cmt$pp_registers
*copyc dst$iou_resource
*copyc iot$logical_unit
*copyc iot$pp_number
*copyc ost$caller_identifier
?? POP ??
*copyc amp$close
*copyc amp$open
*copyc amp$put_next
*copyc clp$begin_utility
*copyc clp$close_display
*copyc clp$convert_integer_to_string
*copyc clp$end_scan_command_file
*copyc clp$end_utility
*copyc clp$evaluate_parameters
*copyc clp$get_set_count
*copyc clp$get_value
*copyc clp$get_value_count
*copyc clp$include_file
*copyc clp$new_display_line
*copyc clp$open_display
*copyc clp$put_display
*copyc clp$put_partial_display
*copyc clp$scan_command_file
*copyc clp$scan_parameter_list
*copyc clp$test_parameter
*copyc cmp$convert_channel_number
*copyc cmp$convert_iou_name
*copyc cmp$convert_iou_number
*copyc cmp$convert_pp_number
*copyc cmp$get_channel_definition
*copyc cmp$get_element_definition
*copyc cmp$get_iou_definition
*copyc cmp$get_pp_definition
*copyc cmp$return_desc_data_by_lun_lpn
*copyc cmp$return_descriptor_data
*copyc cmp$return_logical_pp_number
*copyc fsp$close_file
*copyc fsp$open_file
*copyc msp$execute_pp_program
*copyc msp$get_pp_registers
*copyc msp$idle_pp
*copyc msp$mount_storage_medium
*copyc msp$release_element
*copyc msp$release_maintenance_access
*copyc msp$request_maintenance_access
*copyc msp$reserve_element
*copyc msp$resume_pp
*copyc msp$validate_media_access
*copyc osp$set_status_abnormal
*copyc pmp$close_object_library
*copyc pmp$find_module_in_library
*copyc pmp$open_object_library
?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Declared By This Module', EJECT ??

  VAR
    msv$utility_name: [STATIC, READ, oss$job_paged_literal] ost$name := 'MAINTENANCE_SERVICES_UTILITY';


?? OLDTITLE ??
?? NEWTITLE := '   MSP$MAINTENANCE_SERVICES_UTL', EJECT ??

  PROCEDURE [XDCL, #GATE] maintenance_services_utility
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{ PROCEDURE msu_pdt (
{   status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 1] of clt$pdt_parameter_name,
      parameters: array [1 .. 1] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [103, 11, 4, 11, 29, 7, 983],
    clc$command, 1, 1, 0, 0, 0, 0, 1, ''], [
    ['STATUS                         ',clc$nominal_entry, 1]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$status = 1;

    VAR
      pvt: array [1 .. 1] of clt$parameter_value;

{ table msu_command_list t=c s=local sn=oss$job_paged_literal
{ command (display_channel_definition     ,discd) msp$display_channel_command cm=local
{ command (display_iou_definition         ,disid) msp$display_iou_command cm=local
{ command (display_pp_definition          ,dispd) msp$display_ppd_command cm=local
{ command (display_pp_registers           ,dispr) msp$display_ppr_command cm=local
{ command (execute_pp_program             ,exepp) msp$execute_pp_command cm=local
{ command (idle_pp                        ,idlp) msp$idle_pp_command cm=local
{ command (mount_storage_medium           ,mousm) msp$mount_storage_command cm=local
{ command (release_element                ,rele) msp$release_element_command cm=local
{ command (release_maintenance_access     ,relma) msp$release_access_command cm=local
{ command (request_maintenance_access     ,reqma) msp$request_access_command cm=local
{ command (reserve_element                ,rese) msp$reserve_element_command cm=local
{ command (resume_pp                      ,resp) msp$resume_pp_command cm=local
{ command (quit                           ,qui) msp$quit_command cm=local
{ command (test_return_descriptor_data    ,tesrdd) msp$test_return_descriptor_data cm=local
{ command (validate_media_access          ,valma) msp$validate_media_command cm=local
{ tablend

?? PUSH (LISTEXT := ON) ??

    VAR
      msu_command_list: [STATIC, READ, oss$job_paged_literal] ^clt$command_table := ^msu_command_list_entries,

      msu_command_list_entries: [STATIC, READ, oss$job_paged_literal] array [1 .. 30] of
            clt$command_table_entry := [
            {} ['DISCD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 1,
            clc$automatically_log, clc$linked_call, ^msp$display_channel_command],
            {} ['DISID                          ', clc$abbreviation_entry, clc$normal_usage_entry, 2,
            clc$automatically_log, clc$linked_call, ^msp$display_iou_command],
            {} ['DISPD                          ', clc$abbreviation_entry, clc$normal_usage_entry, 3,
            clc$automatically_log, clc$linked_call, ^msp$display_ppd_command],
            {} ['DISPLAY_CHANNEL_DEFINITION     ', clc$nominal_entry, clc$normal_usage_entry, 1,
            clc$automatically_log, clc$linked_call, ^msp$display_channel_command],
            {} ['DISPLAY_IOU_DEFINITION         ', clc$nominal_entry, clc$normal_usage_entry, 2,
            clc$automatically_log, clc$linked_call, ^msp$display_iou_command],
            {} ['DISPLAY_PP_DEFINITION          ', clc$nominal_entry, clc$normal_usage_entry, 3,
            clc$automatically_log, clc$linked_call, ^msp$display_ppd_command],
            {} ['DISPLAY_PP_REGISTERS           ', clc$nominal_entry, clc$normal_usage_entry, 4,
            clc$automatically_log, clc$linked_call, ^msp$display_ppr_command],
            {} ['DISPR                          ', clc$abbreviation_entry, clc$normal_usage_entry, 4,
            clc$automatically_log, clc$linked_call, ^msp$display_ppr_command],
            {} ['EXECUTE_PP_PROGRAM             ', clc$nominal_entry, clc$normal_usage_entry, 5,
            clc$automatically_log, clc$linked_call, ^msp$execute_pp_command],
            {} ['EXEPP                          ', clc$abbreviation_entry, clc$normal_usage_entry, 5,
            clc$automatically_log, clc$linked_call, ^msp$execute_pp_command],
            {} ['IDLE_PP                        ', clc$nominal_entry, clc$normal_usage_entry, 6,
            clc$automatically_log, clc$linked_call, ^msp$idle_pp_command],
            {} ['IDLP                           ', clc$abbreviation_entry, clc$normal_usage_entry, 6,
            clc$automatically_log, clc$linked_call, ^msp$idle_pp_command],
            {} ['MOUNT_STORAGE_MEDIUM           ', clc$nominal_entry, clc$normal_usage_entry, 7,
            clc$automatically_log, clc$linked_call, ^msp$mount_storage_command],
            {} ['MOUSM                          ', clc$abbreviation_entry, clc$normal_usage_entry, 7,
            clc$automatically_log, clc$linked_call, ^msp$mount_storage_command],
            {} ['QUI                            ', clc$abbreviation_entry, clc$normal_usage_entry, 13,
            clc$automatically_log, clc$linked_call, ^msp$quit_command],
            {} ['QUIT                           ', clc$nominal_entry, clc$normal_usage_entry, 13,
            clc$automatically_log, clc$linked_call, ^msp$quit_command],
            {} ['RELE                           ', clc$abbreviation_entry, clc$normal_usage_entry, 8,
            clc$automatically_log, clc$linked_call, ^msp$release_element_command],
            {} ['RELEASE_ELEMENT                ', clc$nominal_entry, clc$normal_usage_entry, 8,
            clc$automatically_log, clc$linked_call, ^msp$release_element_command],
            {} ['RELEASE_MAINTENANCE_ACCESS     ', clc$nominal_entry, clc$normal_usage_entry, 9,
            clc$automatically_log, clc$linked_call, ^msp$release_access_command],
            {} ['RELMA                          ', clc$abbreviation_entry, clc$normal_usage_entry, 9,
            clc$automatically_log, clc$linked_call, ^msp$release_access_command],
            {} ['REQMA                          ', clc$abbreviation_entry, clc$normal_usage_entry, 10,
            clc$automatically_log, clc$linked_call, ^msp$request_access_command],
            {} ['REQUEST_MAINTENANCE_ACCESS     ', clc$nominal_entry, clc$normal_usage_entry, 10,
            clc$automatically_log, clc$linked_call, ^msp$request_access_command],
            {} ['RESE                           ', clc$abbreviation_entry, clc$normal_usage_entry, 11,
            clc$automatically_log, clc$linked_call, ^msp$reserve_element_command],
            {} ['RESERVE_ELEMENT                ', clc$nominal_entry, clc$normal_usage_entry, 11,
            clc$automatically_log, clc$linked_call, ^msp$reserve_element_command],
            {} ['RESP                           ', clc$abbreviation_entry, clc$normal_usage_entry, 12,
            clc$automatically_log, clc$linked_call, ^msp$resume_pp_command],
            {} ['RESUME_PP                      ', clc$nominal_entry, clc$normal_usage_entry, 12,
            clc$automatically_log, clc$linked_call, ^msp$resume_pp_command],
            {} ['TESRDD                         ', clc$abbreviation_entry, clc$normal_usage_entry, 14,
            clc$automatically_log, clc$linked_call, ^msp$test_return_descriptor_data],
            {} ['TEST_RETURN_DESCRIPTOR_DATA    ', clc$nominal_entry, clc$normal_usage_entry, 14,
            clc$automatically_log, clc$linked_call, ^msp$test_return_descriptor_data],
            {} ['VALIDATE_MEDIA_ACCESS          ', clc$nominal_entry, clc$normal_usage_entry, 15,
            clc$automatically_log, clc$linked_call, ^msp$validate_media_command],
            {} ['VALMA                          ', clc$abbreviation_entry, clc$normal_usage_entry, 15,
            clc$automatically_log, clc$linked_call, ^msp$validate_media_command]];

?? POP ??


    VAR
      caller_id: ost$caller_identifier,
      utility_attributes: array [1 .. 2] of clt$utility_attribute;

    #CALLER_ID (caller_id);
    IF caller_id.ring > 6 THEN
      osp$set_status_abnormal (cmc$configuration_management_id, cme$lcm_ring_validation_error, 'MSU', status);
      RETURN; {----->
    IFEND;
    status.normal := TRUE;

    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    utility_attributes [1].key := clc$utility_command_table;
    utility_attributes [1].command_table := msu_command_list;
    utility_attributes [2].key := clc$utility_prompt;
    utility_attributes [2].prompt.size := 3;
    utility_attributes [2].prompt.value := 'MSU';

    clp$begin_utility (msv$utility_name, utility_attributes, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$include_file (clc$current_command_input, '', msv$utility_name, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$end_utility (msv$utility_name, status);

  PROCEND maintenance_services_utility;
?? OLDTITLE ??
?? NEWTITLE := '  Alias MSU ', EJECT ??

  PROCEDURE [XDCL, #GATE] msu
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

    maintenance_services_utility (parameter_list, status);

  PROCEND msu;

?? TITLE := '  msp$reserve_element_command', EJECT ??

  PROCEDURE msp$reserve_element_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{  PDT reserve_element_pdt (
{     element_type, et : LIST of name = $required
{     element_name, n : LIST of name = $optional
{     channel, c : LIST of name = $optional
{     equipment_number, en : LIST OF integer 0 .. 7 = $optional
{     unit_number , un : LIST  OF integer 0 .. 63 = $optional
{     pp : list of name = $optional
{     iou : LIST OF name = $optional
{     status)

?? PUSH (LISTEXT := ON) ??

    VAR
      reserve_element_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^reserve_element_pdt_names, ^reserve_element_pdt_params];

    VAR
      reserve_element_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 13] of
            clt$parameter_name_descriptor := [['ELEMENT_TYPE', 1], ['ET', 1], ['ELEMENT_NAME', 2], ['N', 2],
            ['CHANNEL', 3], ['C', 3], ['EQUIPMENT_NUMBER', 4], ['EN', 4], ['UNIT_NUMBER', 5], ['UN', 5],
            ['PP', 6], ['IOU', 7], ['STATUS', 8]];

    VAR
      reserve_element_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 8] of
            clt$parameter_descriptor := [

{ ELEMENT_TYPE ET }
      [[clc$required], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ ELEMENT_NAME N }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ CHANNEL C }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ EQUIPMENT_NUMBER EN }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$integer_value, 0, 7]],

{ UNIT_NUMBER UN }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$integer_value, 0, 63]],

{ PP }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ IOU }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

?? POP ??

    VAR
      element: ^array [1 .. * ] of cmt$element_reservation,
      set_count: 0 .. clc$max_value_sets;

    status.normal := TRUE;
    clp$scan_parameter_list (parameter_list, reserve_element_pdt, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$get_set_count ('ELEMENT_TYPE', set_count, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;
    PUSH element: [1 .. set_count];
    crack_reserve_param (element, {Reserve=} TRUE, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;
    msp$reserve_element (element^, status);

  PROCEND msp$reserve_element_command;

?? TITLE := '  crack_reserve_param', EJECT ??

  PROCEDURE crack_reserve_param
    (    element: ^array [1 .. * ] of cmt$element_reservation;
         reserve_element: boolean;
     VAR status: ost$status);

    VAR
      channel_descriptor: cmt$channel_descriptor,
      channel_definition: cmt$data_channel_definition,
      pp_specified,
      name_specified,
      channel_specified,
      equipment_specified,
      iou_specified,
      unit_specified: boolean,
      value: clt$value,
      i,
      name_index,
      channel_index,
      controller_index,
      channel_adapter_index,
      communications_index,
      iou_index,
      pp_index,
      storage_device_index: integer,
      pp_descriptor: cmt$pp_descriptor,
      pp_definition: cmt$pp_definition,
      pp: dst$iou_resource,
      iou_name: cmt$element_name,
      set_count: 0 .. clc$max_value_sets;

    status.normal := TRUE;

  /main_program/
    BEGIN

      clp$test_parameter ('ELEMENT_NAME', name_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('CHANNEL', channel_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('EQUIPMENT_NUMBER', equipment_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('UNIT_NUMBER', unit_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF name_specified THEN
        IF (channel_specified) OR (equipment_specified) OR (unit_specified) THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Either NAME or HARDWARE ADDRESS entered.', status);
          EXIT /main_program/; {----->
        IFEND;
      IFEND;

      clp$test_parameter ('PP', pp_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('IOU', iou_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$get_set_count ('ELEMENT_TYPE', set_count, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      name_index := 1;
      channel_index := 1;
      controller_index := 1;
      channel_adapter_index := 1;
      communications_index := 1;
      iou_index := 1;
      pp_index := 1;
      storage_device_index := 1;

      FOR i := 1 TO set_count DO

        clp$get_value ('ELEMENT_TYPE', i, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        IF value.kind <> clc$name_value THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid ELEMENT_TYPE in RESERVE_ELEMENT command.', status);
          EXIT /main_program/; {----->
        IFEND;

        IF value.name.value = '$PP' THEN
          IF NOT reserve_element AND NOT pp_specified THEN
            osp$set_status_abnormal (cmc$configuration_management_id, 0,
                  'PP_NUMBER is required in RELEASE_ELEMENT command.', status);
            EXIT /main_program/; {----->
          IFEND;

          element^ [i].element_type := cmc$pp_element;
          element^ [i].pp_reservation.selector := cmc$choose_any_pp;

          IF channel_specified OR pp_specified THEN
            IF iou_specified THEN
              clp$get_value ('IOU', iou_index, 1, clc$low, value, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              iou_index := iou_index + 1;
              iou_name := value.name.value;
            ELSE
              iou_name := 'IOU0';
            IFEND;
            IF pp_specified THEN
              clp$get_value ('PP', pp_index, 1, clc$low, value, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              pp_index := pp_index + 1;
              pp_descriptor.iou := iou_name;
              pp_descriptor.use_logical_identification := TRUE;
              pp_descriptor.pp_name := value.name.value;
              cmp$get_pp_definition (pp_descriptor, pp_definition, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              pp.number := pp_definition.number;
              IF pp_definition.concurrent THEN
                pp.channel_protocol := dsc$cpt_cio;
              ELSE
                pp.channel_protocol := dsc$cpt_nio;
              IFEND;
              cmp$convert_iou_name (iou_name, pp.iou_number, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;

              element^ [i].pp_reservation.selector := cmc$choose_specific_pp;
              IF reserve_element THEN
                cmp$convert_pp_number (pp, element^ [i].pp_reservation.desired_pp.ordinal);
              ELSE
                cmp$convert_pp_number (pp, element^ [i].pp_reservation.acquired_pp_identification.ordinal);
                element^ [i].pp_reservation.acquired_pp_identification.iou := iou_name;
              IFEND;
              element^ [i].pp_reservation.desired_pp.iou := iou_name;

            ELSE {use channel}

              clp$get_value ('CHANNEL', channel_index, 1, clc$low, value, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              channel_index := channel_index + 1;
              channel_descriptor.iou := iou_name;
              channel_descriptor.use_logical_identification := TRUE;
              channel_descriptor.name := value.name.value;
              cmp$get_channel_definition (channel_descriptor, channel_definition, status);
              IF NOT status.normal THEN
                IF status.condition = cme$lcm_element_not_found THEN
                  status.normal := TRUE;
                ELSE
                  EXIT /main_program/; {----->
                IFEND;
              IFEND;
              element^ [i].pp_reservation.selector := cmc$choose_pp_by_channel;
              element^ [i].pp_reservation.channel.ordinal := channel_definition.ordinal;
              element^ [i].pp_reservation.channel.iou := iou_name;
            IFEND;
          IFEND;

        ELSEIF value.name.value = '$CHANNEL' THEN
          element^ [i].element_type := cmc$data_channel_element;
          IF iou_specified THEN
            clp$get_value ('IOU', iou_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;
            iou_index := iou_index + 1;
            iou_name := value.name.value;
          ELSE
            iou_name := 'IOU0';
          IFEND;
          element^ [i].channel_descriptor.iou := iou_name;

          IF name_specified THEN
            element^ [i].channel_descriptor.use_logical_identification := TRUE;
            clp$get_value ('ELEMENT_NAME', name_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$name_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid ELEMENT_NAME in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].channel_descriptor.name := value.name.value;
            name_index := name_index + 1;
          ELSE
            clp$get_value ('CHANNEL', channel_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            channel_descriptor.iou := iou_name;
            channel_descriptor.use_logical_identification := TRUE;
            channel_descriptor.name := value.name.value;
            cmp$get_channel_definition (channel_descriptor, channel_definition, status);
            IF NOT status.normal THEN
              IF status.condition = cme$lcm_element_not_found THEN
                status.normal := TRUE;
              ELSE
                EXIT /main_program/; {----->
              IFEND;
            IFEND;
            element^ [i].channel_descriptor.use_logical_identification := FALSE;
            element^ [i].channel_descriptor.channel_ordinal := channel_definition.ordinal;
            element^ [i].channel_descriptor.number := channel_definition.number;
            element^ [i].channel_descriptor.concurrent := channel_definition.concurrent;
            channel_index := channel_index + 1;
          IFEND;

        ELSEIF value.name.value = '$CONTROLLER' THEN
          element^ [i].element_type := cmc$controller_element;
          IF name_specified THEN
            element^ [i].peripheral_descriptor.use_logical_identification := TRUE;
            clp$get_value ('ELEMENT_NAME', name_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$name_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid ELEMENT_NAME in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.element_name := value.name.value;
            name_index := name_index + 1;
          ELSE
            element^ [i].peripheral_descriptor.use_logical_identification := FALSE;
            element^ [i].peripheral_descriptor.hardware_address.physical_address_specifier :=
                  $cmt$physical_address_specifier [cmc$iou, cmc$channel, cmc$channel_address];

            clp$get_value ('CHANNEL', channel_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;
            channel_descriptor.iou := iou_name;
            channel_descriptor.use_logical_identification := TRUE;
            channel_descriptor.name := value.name.value;
            cmp$get_channel_definition (channel_descriptor, channel_definition, status);
            IF NOT status.normal THEN
              IF status.condition = cme$lcm_element_not_found THEN
                status.normal := TRUE;
              ELSE
                EXIT /main_program/; {----->
              IFEND;
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.channel.ordinal := channel_definition.ordinal;
            channel_index := channel_index + 1;

            clp$get_value ('EQUIPMENT_NUMBER', controller_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$integer_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid EQUIPMENT_NUMBER in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.channel_address := value.int.value;
            controller_index := controller_index + 1;

            IF iou_specified THEN
              clp$get_value ('IOU', iou_index, 1, clc$low, value, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              iou_name := value.name.value;
              iou_index := iou_index + 1;
            ELSE
              iou_name := 'IOU0'
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.iou := iou_name;
          IFEND;

        ELSEIF value.name.value = '$CA' THEN
          element^ [i].element_type := cmc$channel_adapter_element;
          IF name_specified THEN
            element^ [i].peripheral_descriptor.use_logical_identification := TRUE;
            clp$get_value ('ELEMENT_NAME', name_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$name_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid ELEMENT_NAME in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.element_name := value.name.value;
            name_index := name_index + 1;
          ELSE
            element^ [i].peripheral_descriptor.use_logical_identification := FALSE;
            element^ [i].peripheral_descriptor.hardware_address.physical_address_specifier :=
                  $cmt$physical_address_specifier [cmc$iou, cmc$channel, cmc$channel_address];
            IF iou_specified THEN
              clp$get_value ('IOU', iou_index, 1, clc$low, value, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              iou_name := value.name.value;
              iou_index := iou_index + 1;
            ELSE
              iou_name := 'IOU0'
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.iou := iou_name;

            clp$get_value ('CHANNEL', channel_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            channel_descriptor.iou := iou_name;
            channel_descriptor.use_logical_identification := TRUE;
            channel_descriptor.name := value.name.value;
            cmp$get_channel_definition (channel_descriptor, channel_definition, status);
            IF NOT status.normal THEN
              IF status.condition = cme$lcm_element_not_found THEN
                status.normal := TRUE;
              ELSE
                EXIT /main_program/; {----->
              IFEND;
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.channel.ordinal := channel_definition.ordinal;
            channel_index := channel_index + 1;

            clp$get_value ('EQUIPMENT_NUMBER', channel_adapter_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$integer_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid EQUIPMENT_NUMBER in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.channel_address := value.int.value;
            channel_adapter_index := channel_adapter_index + 1;
          IFEND;
        ELSEIF value.name.value = '$COMMUNICATIONS' THEN
          element^ [i].element_type := cmc$communications_element;
          IF name_specified THEN
            element^ [i].peripheral_descriptor.use_logical_identification := TRUE;
            clp$get_value ('ELEMENT_NAME', name_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$name_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid ELEMENT_NAME in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.element_name := value.name.value;
            name_index := name_index + 1;
          ELSE
            element^ [i].peripheral_descriptor.use_logical_identification := FALSE;
            element^ [i].peripheral_descriptor.hardware_address.physical_address_specifier :=
                  $cmt$physical_address_specifier [cmc$iou, cmc$channel, cmc$channel_address];

            IF iou_specified THEN
              clp$get_value ('IOU', iou_index, 1, clc$low, value, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              iou_name := value.name.value;
              iou_index := iou_index + 1;
            ELSE
              iou_name := 'IOU0'
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.iou := iou_name;

            clp$get_value ('CHANNEL', channel_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;
            channel_descriptor.iou := iou_name;
            channel_descriptor.use_logical_identification := TRUE;
            channel_descriptor.name := value.name.value;
            cmp$get_channel_definition (channel_descriptor, channel_definition, status);
            IF NOT status.normal THEN
              IF status.condition = cme$lcm_element_not_found THEN
                status.normal := TRUE;
              ELSE
                EXIT /main_program/; {----->
              IFEND;
            IFEND;

            element^ [i].peripheral_descriptor.hardware_address.channel.ordinal := channel_definition.ordinal;
            channel_index := channel_index + 1;

            clp$get_value ('EQUIPMENT_NUMBER', channel_adapter_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$integer_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid EQUIPMENT_NUMBER in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.channel_address := value.int.value;
            communications_index := communications_index + 1;
          IFEND;

        ELSEIF value.name.value = '$STORAGE_DEVICE' THEN
          element^ [i].element_type := cmc$storage_device_element;
          IF name_specified THEN
            element^ [i].peripheral_descriptor.use_logical_identification := TRUE;
            clp$get_value ('ELEMENT_NAME', name_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$name_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid ELEMENT_NAME in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.element_name := value.name.value;
            name_index := name_index + 1;
          ELSE
            element^ [i].peripheral_descriptor.use_logical_identification := FALSE;
            element^ [i].peripheral_descriptor.hardware_address.physical_address_specifier :=
                  $cmt$physical_address_specifier [cmc$iou, cmc$channel, cmc$channel_address,
                  cmc$unit_address];

            IF iou_specified THEN
              clp$get_value ('IOU', iou_index, 1, clc$low, value, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              iou_name := value.name.value;
              iou_index := iou_index + 1;
            ELSE
              iou_name := 'IOU0'
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.iou := iou_name;

            clp$get_value ('CHANNEL', channel_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;
            channel_descriptor.iou := iou_name;
            channel_descriptor.use_logical_identification := TRUE;
            channel_descriptor.name := value.name.value;
            cmp$get_channel_definition (channel_descriptor, channel_definition, status);
            IF NOT status.normal THEN
              IF status.condition = cme$lcm_element_not_found THEN
                status.normal := TRUE;
              ELSE
                EXIT /main_program/; {----->
              IFEND;
            IFEND;

            element^ [i].peripheral_descriptor.hardware_address.channel.ordinal := channel_definition.ordinal;
            channel_index := channel_index + 1;

            clp$get_value ('EQUIPMENT_NUMBER', controller_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$integer_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid EQUIPMENT_NUMBER in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.channel_address := value.int.value;
            controller_index := controller_index + 1;

            clp$get_value ('UNIT_NUMBER', storage_device_index, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;

            IF value.kind <> clc$integer_value THEN
              osp$set_status_abnormal (cmc$configuration_management_id, 0,
                    'Invalid UNIT_NUMBER in RESERVE_ELEMENT command.', status);
              EXIT /main_program/; {----->
            IFEND;
            element^ [i].peripheral_descriptor.hardware_address.unit_address := value.int.value;
            storage_device_index := storage_device_index + 1;
          IFEND;
        ELSE
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid ELEMENT_TYPE in RESERVE_ELEMENT command.', status);
          EXIT /main_program/; {----->
        IFEND;

      FOREND;

    END /main_program/;

  PROCEND crack_reserve_param;

?? TITLE := '  msp$release_element_command', EJECT ??

  PROCEDURE msp$release_element_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{  PDT release_element_pdt (
{     element_type, et : LIST of name = $required
{     element_name, n : LIST of name = $optional
{     channel, c : LIST of name = $optional
{     equipment_number, en : LIST OF integer 0 .. 7 = $optional
{     unit_number , un : LIST  OF integer 0 .. 63 = $optional
{     pp : list of name = $optional
{     iou : LIST OF name = $optional
{     status)

?? PUSH (LISTEXT := ON) ??

    VAR
      release_element_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^release_element_pdt_names, ^release_element_pdt_params];

    VAR
      release_element_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 13] of
            clt$parameter_name_descriptor := [['ELEMENT_TYPE', 1], ['ET', 1], ['ELEMENT_NAME', 2], ['N', 2],
            ['CHANNEL', 3], ['C', 3], ['EQUIPMENT_NUMBER', 4], ['EN', 4], ['UNIT_NUMBER', 5], ['UN', 5],
            ['PP', 6], ['IOU', 7], ['STATUS', 8]];

    VAR
      release_element_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 8] of
            clt$parameter_descriptor := [

{ ELEMENT_TYPE ET }
      [[clc$required], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ ELEMENT_NAME N }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ CHANNEL C }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ EQUIPMENT_NUMBER EN }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$integer_value, 0, 7]],

{ UNIT_NUMBER UN }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$integer_value, 0, 63]],

{ PP }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ IOU }
      [[clc$optional], 1, clc$max_value_sets, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

?? POP ??

    VAR
      element: ^array [1 .. * ] of cmt$element_reservation,
      set_count: 0 .. clc$max_value_sets;

    status.normal := TRUE;

    clp$scan_parameter_list (parameter_list, release_element_pdt, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$get_set_count ('ELEMENT_TYPE', set_count, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    PUSH element: [1 .. set_count];
    crack_reserve_param (element, {Reserve=} FALSE, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;
    msp$release_element (element^, status);

  PROCEND msp$release_element_command;

?? TITLE := '  msp$request_access_command', EJECT ??

  PROCEDURE msp$request_access_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{  PDT request_access_pdt (
{     element_type, et : name = $required
{     access_type , at : name = $required
{     element_name, n : name = $optional
{     channel, c : name = $optional
{     equipment_number, en : integer 0 .. 7 = $optional
{     unit_number , un : integer 0 .. 63 = $optional
{     iou : name = IOU0
{     status)

?? PUSH (LISTEXT := ON) ??

    VAR
      request_access_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^request_access_pdt_names, ^request_access_pdt_params];

    VAR
      request_access_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 14] of
            clt$parameter_name_descriptor := [['ELEMENT_TYPE', 1], ['ET', 1], ['ACCESS_TYPE', 2], ['AT', 2],
            ['ELEMENT_NAME', 3], ['N', 3], ['CHANNEL', 4], ['C', 4], ['EQUIPMENT_NUMBER', 5], ['EN', 5],
            ['UNIT_NUMBER', 6], ['UN', 6], ['IOU', 7], ['STATUS', 8]];

    VAR
      request_access_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 8] of
            clt$parameter_descriptor := [

{ ELEMENT_TYPE ET }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ ACCESS_TYPE AT }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ ELEMENT_NAME N }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ CHANNEL C }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ EQUIPMENT_NUMBER EN }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 0, 7]],

{ UNIT_NUMBER UN }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 0, 63]],

{ IOU }
      [[clc$optional_with_default, ^request_access_pdt_dv7], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      request_access_pdt_dv7: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

?? POP ??

    VAR
      access: mst$access_type,
      element_descriptor: cmt$element_descriptor;

    status.normal := TRUE;
    clp$scan_parameter_list (parameter_list, request_access_pdt, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;
    crack_request_param (TRUE, access, element_descriptor, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;
    msp$request_maintenance_access (element_descriptor, access, status);

  PROCEND msp$request_access_command;

?? TITLE := '   crack_request_param', EJECT ??

  PROCEDURE crack_request_param
    (    request_maintenance: boolean;
     VAR access_type: mst$access_type;
     VAR element_descriptor: cmt$element_descriptor;
     VAR status: ost$status);


    VAR
      channel_name: cmt$element_name,
      channel_descriptor: cmt$channel_descriptor,
      channel_definition: cmt$data_channel_definition,
      channel_specified,
      equipment_specified,
      unit_specified,
      name_specified: boolean,
      value: clt$value,
      equipment_number,
      unit_number: integer,
      iou_name,
      element_name: cmt$element_name;

    status.normal := TRUE;

  /main_program/
    BEGIN

      clp$test_parameter ('ELEMENT_NAME', name_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF name_specified THEN
        clp$get_value ('ELEMENT_NAME', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        IF value.kind <> clc$name_value THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid ELEMENT_NAME in REQUEST_MAINTENANCE_ACCESS command.', status);
          EXIT /main_program/; {----->
        ELSE
          element_name := value.name.value;
        IFEND;
      IFEND;
      clp$get_value ('IOU', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      iou_name := value.name.value;

      clp$test_parameter ('CHANNEL', channel_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF channel_specified THEN
        clp$get_value ('CHANNEL', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        channel_name := value.name.value;
        channel_descriptor.iou := iou_name;
        channel_descriptor.use_logical_identification := TRUE;
        channel_descriptor.name := value.name.value;
        cmp$get_channel_definition (channel_descriptor, channel_definition, status);
        IF NOT status.normal THEN
          IF status.condition = cme$lcm_element_not_found THEN
            status.normal := TRUE;
          ELSE
            EXIT /main_program/; {----->
          IFEND;
        IFEND;
      IFEND;

      clp$test_parameter ('EQUIPMENT_NUMBER', equipment_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF equipment_specified THEN
        clp$get_value ('EQUIPMENT_NUMBER', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        IF value.kind <> clc$integer_value THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid EQUIPMENT_NUMBER in REQUEST_MAINTENANCE_ACCESS command.', status);
          EXIT /main_program/; {----->
        ELSE
          equipment_number := value.int.value;
        IFEND;
      IFEND;

      clp$test_parameter ('UNIT_NUMBER', unit_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF unit_specified THEN
        clp$get_value ('UNIT_NUMBER', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        IF value.kind <> clc$integer_value THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid UNIT_NUMBER in REQUEST_MAINTENANCE_ACCESS command.', status);
          EXIT /main_program/; {----->
        ELSE
          unit_number := value.int.value;
        IFEND;
      IFEND;


      IF name_specified THEN
        IF (channel_specified) OR (equipment_specified) OR (unit_specified) THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Either NAME or HARDWARE ADDRESS entered.', status);
          EXIT /main_program/; {----->
        IFEND;
      IFEND;

      IF request_maintenance THEN

        clp$get_value ('ACCESS_TYPE', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        IF value.kind <> clc$name_value THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid ACCESS_TYPE in REQUEST_MAINTENANCE_ACCESS command.', status);
          EXIT /main_program/; {----->
        IFEND;

        IF (value.name.value <> 'C') AND (value.name.value <> 'D') THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid ACCESS_TYPE in REQUEST_MAINTENANCE_ACCESS command.', status);
          EXIT /main_program/; {----->
        ELSE
          IF value.name.value = 'C' THEN
            access_type := msc$concurrent_access;
          ELSE
            access_type := msc$dedicated_access;
          IFEND;
        IFEND;
      IFEND;
      clp$get_value ('ELEMENT_TYPE', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF value.kind <> clc$name_value THEN
        osp$set_status_abnormal (cmc$configuration_management_id, 0,
              'Invalid ELEMENT_TYPE in REQUEST_MAINTENANCE_ACCESS command.', status);
        EXIT /main_program/; {----->
      IFEND;

      IF value.name.value = '$CHANNEL' THEN
        element_descriptor.element_type := cmc$data_channel_element;
        element_descriptor.channel_descriptor.iou := iou_name;
        IF name_specified THEN
          element_descriptor.channel_descriptor.use_logical_identification := TRUE;
          element_descriptor.channel_descriptor.name := element_name;
        ELSE
          element_descriptor.channel_descriptor.use_logical_identification := FALSE;
          element_descriptor.channel_descriptor.channel_ordinal := channel_definition.ordinal;
          element_descriptor.channel_descriptor.number := channel_definition.number;
          element_descriptor.channel_descriptor.concurrent := channel_definition.concurrent;
        IFEND;

      ELSEIF value.name.value = '$CONTROLLER' THEN
        element_descriptor.element_type := cmc$controller_element;
        IF name_specified THEN
          element_descriptor.peripheral_descriptor.use_logical_identification := TRUE;
          element_descriptor.peripheral_descriptor.element_name := element_name;
        ELSE
          element_descriptor.peripheral_descriptor.use_logical_identification := FALSE;
          element_descriptor.peripheral_descriptor.hardware_address.physical_address_specifier :=
                $cmt$physical_address_specifier [cmc$iou, cmc$channel, cmc$channel_address];
          element_descriptor.peripheral_descriptor.hardware_address.iou := iou_name;
          element_descriptor.peripheral_descriptor.hardware_address.channel.ordinal :=
                channel_definition.ordinal;
          element_descriptor.peripheral_descriptor.hardware_address.channel_address := equipment_number;
        IFEND;

      ELSEIF value.name.value = '$STORAGE_DEVICE' THEN
        element_descriptor.element_type := cmc$storage_device_element;
        IF name_specified THEN
          element_descriptor.peripheral_descriptor.use_logical_identification := TRUE;
          element_descriptor.peripheral_descriptor.element_name := element_name;
        ELSE
          element_descriptor.peripheral_descriptor.use_logical_identification := FALSE;
          element_descriptor.peripheral_descriptor.hardware_address.physical_address_specifier :=
                $cmt$physical_address_specifier [cmc$iou, cmc$channel, cmc$channel_address, cmc$unit_address];
          element_descriptor.peripheral_descriptor.hardware_address.iou := iou_name;
          element_descriptor.peripheral_descriptor.hardware_address.channel.ordinal :=
                channel_definition.ordinal;
          element_descriptor.peripheral_descriptor.hardware_address.channel_address := equipment_number;
          element_descriptor.peripheral_descriptor.hardware_address.unit_address := unit_number;
        IFEND;
      ELSEIF value.name.value = '$COMMUNICATIONS' THEN
        element_descriptor.element_type := cmc$communications_element;
        IF name_specified THEN
          element_descriptor.peripheral_descriptor.use_logical_identification := TRUE;
          element_descriptor.peripheral_descriptor.element_name := element_name;
        ELSE
          element_descriptor.peripheral_descriptor.use_logical_identification := FALSE;
          element_descriptor.peripheral_descriptor.hardware_address.physical_address_specifier :=
                $cmt$physical_address_specifier [cmc$iou, cmc$channel, cmc$channel_address];
          element_descriptor.peripheral_descriptor.hardware_address.iou := iou_name;
          element_descriptor.peripheral_descriptor.hardware_address.channel.ordinal :=
                channel_definition.ordinal;
          element_descriptor.peripheral_descriptor.hardware_address.channel_address := equipment_number;
        IFEND;

      ELSE
        osp$set_status_abnormal (cmc$configuration_management_id, 0,
              'Invalid ELEMENT_TYPE in REQUEST_MAINTENANCE_ACCESS command.', status);
        EXIT /main_program/; {----->
      IFEND;
    END /main_program/;

  PROCEND crack_request_param;


?? TITLE := '  msp$release_access_command', EJECT ??

  PROCEDURE msp$release_access_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{  PDT release_access_pdt (
{     element_type, et : name = $required
{     element_name, n : name = $optional
{     channel, c : name = $optional
{     equipment_number, en : integer 0 .. 7 = $optional
{     unit_number , un : integer 0 .. 63 = $optional
{     iou : name = IOU0
{     status)

?? PUSH (LISTEXT := ON) ??

    VAR
      release_access_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^release_access_pdt_names, ^release_access_pdt_params];

    VAR
      release_access_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 12] of
            clt$parameter_name_descriptor := [['ELEMENT_TYPE', 1], ['ET', 1], ['ELEMENT_NAME', 2], ['N', 2],
            ['CHANNEL', 3], ['C', 3], ['EQUIPMENT_NUMBER', 4], ['EN', 4], ['UNIT_NUMBER', 5], ['UN', 5],
            ['IOU', 6], ['STATUS', 7]];

    VAR
      release_access_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 7] of
            clt$parameter_descriptor := [

{ ELEMENT_TYPE ET }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ ELEMENT_NAME N }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ CHANNEL C }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ EQUIPMENT_NUMBER EN }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 0, 7]],

{ UNIT_NUMBER UN }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 0, 63]],

{ IOU }
      [[clc$optional_with_default, ^release_access_pdt_dv6], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      release_access_pdt_dv6: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

?? POP ??

    VAR
      access_type: mst$access_type,
      element_descriptor: cmt$element_descriptor;

    status.normal := TRUE;
    clp$scan_parameter_list (parameter_list, release_access_pdt, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    crack_request_param (FALSE, access_type, element_descriptor, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;
    msp$release_maintenance_access (element_descriptor, status);

  PROCEND msp$release_access_command;

?? TITLE := '  msp$mount_storage_command', EJECT ??

  PROCEDURE msp$mount_storage_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{  PDT mount_storage_pdt (
{     medium, m : name = $required
{     write_access, wa : name = $required
{     wait_for_attachment, wfa : name = $required
{     element_name, n : name = $optional
{     channel, c : name = $optional
{     equipment_number, en : integer 0 .. 7 = $optional
{     unit_number , un : integer 0 .. 63 = $optional
{     iou : name = IOU0
{     status)

?? PUSH (LISTEXT := ON) ??

    VAR
      mount_storage_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^mount_storage_pdt_names, ^mount_storage_pdt_params];

    VAR
      mount_storage_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 16] of
            clt$parameter_name_descriptor := [['MEDIUM', 1], ['M', 1], ['WRITE_ACCESS', 2], ['WA', 2],
            ['WAIT_FOR_ATTACHMENT', 3], ['WFA', 3], ['ELEMENT_NAME', 4], ['N', 4], ['CHANNEL', 5], ['C', 5],
            ['EQUIPMENT_NUMBER', 6], ['EN', 6], ['UNIT_NUMBER', 7], ['UN', 7], ['IOU', 8], ['STATUS', 9]];

    VAR
      mount_storage_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 9] of
            clt$parameter_descriptor := [

{ MEDIUM M }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ WRITE_ACCESS WA }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ WAIT_FOR_ATTACHMENT WFA }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ ELEMENT_NAME N }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ CHANNEL C }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ EQUIPMENT_NUMBER EN }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 0, 7]],

{ UNIT_NUMBER UN }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 0, 63]],

{ IOU }
      [[clc$optional_with_default, ^mount_storage_pdt_dv8], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      mount_storage_pdt_dv8: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

?? POP ??

    VAR
      channel_descriptor: cmt$channel_descriptor,
      channel_definition: cmt$data_channel_definition,
      channel_specified,
      equipment_specified,
      unit_specified,
      name_specified: boolean,
      value: clt$value,
      equipment_number,
      unit_number: integer,
      iou_name,
      element_name: cmt$element_name,
      medium: rmt$external_vsn,
      write_access: boolean,
      wait_for_attachment: fst$wait_for_attachment,
      storage_device: cmt$peripheral_descriptor;

    status.normal := TRUE;

  /main_program/
    BEGIN
      clp$scan_parameter_list (parameter_list, mount_storage_pdt, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('ELEMENT_NAME', name_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF name_specified THEN
        clp$get_value ('ELEMENT_NAME', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        IF value.kind <> clc$name_value THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid ELEMENT_NAME in MOUNT_STORAGE_MEDIUM command.', status);
          EXIT /main_program/; {----->
        ELSE
          element_name := value.name.value;
        IFEND;
      IFEND;

      clp$get_value ('IOU', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      iou_name := value.name.value;
      clp$test_parameter ('CHANNEL', channel_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF channel_specified THEN
        clp$get_value ('CHANNEL', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        channel_descriptor.iou := iou_name;
        channel_descriptor.use_logical_identification := TRUE;
        channel_descriptor.name := value.name.value;
        cmp$get_channel_definition (channel_descriptor, channel_definition, status);
        IF NOT status.normal THEN
          IF status.condition = cme$lcm_element_not_found THEN
            status.normal := TRUE;
          ELSE
            EXIT /main_program/; {----->
          IFEND;
        IFEND;

      IFEND;

      clp$test_parameter ('EQUIPMENT_NUMBER', equipment_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF equipment_specified THEN
        clp$get_value ('EQUIPMENT_NUMBER', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        IF value.kind <> clc$integer_value THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid EQUIPMENT_NUMBER in MOUNT_STORAGE_MEDIUM command.', status);
          EXIT /main_program/; {----->
        ELSE
          equipment_number := value.int.value;
        IFEND;
      IFEND;

      clp$test_parameter ('UNIT_NUMBER', unit_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF unit_specified THEN
        clp$get_value ('UNIT_NUMBER', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        IF value.kind <> clc$integer_value THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid UNIT_NUMBER in MOUNT_STORAGE_MEDIUM command.', status);
          EXIT /main_program/; {----->
        ELSE
          unit_number := value.int.value;
        IFEND;
      IFEND;


      IF name_specified THEN
        IF (channel_specified) OR (equipment_specified) OR (unit_specified) THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Either NAME or HARDWARE ADDRESS entered.', status);
          EXIT /main_program/; {----->
        ELSE
          storage_device.use_logical_identification := TRUE;
          storage_device.element_name := element_name;
        IFEND;
      ELSE
        storage_device.use_logical_identification := FALSE;
        storage_device.hardware_address.physical_address_specifier := $cmt$physical_address_specifier
              [cmc$iou, cmc$channel, cmc$channel_address, cmc$unit_address];
        storage_device.hardware_address.iou := iou_name;
        storage_device.hardware_address.channel.ordinal := channel_definition.ordinal;
        storage_device.hardware_address.channel_address := equipment_number;
        storage_device.hardware_address.unit_address := unit_number;
      IFEND;

      clp$get_value ('MEDIUM', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF value.kind <> clc$name_value THEN
        osp$set_status_abnormal (cmc$configuration_management_id, 0,
              'Invalid MEDIUM in MOUNT_STORAGE_MEDIUM command.', status);
        EXIT /main_program/; {----->
      ELSE
        medium := value.name.value;
      IFEND;

      clp$get_value ('WRITE_ACCESS', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF value.kind <> clc$name_value THEN
        osp$set_status_abnormal (cmc$configuration_management_id, 0,
              'Invalid WRITE_ACCESS in MOUNT_STORAGE_MEDIUM command.', status);
        EXIT /main_program/; {----->
      ELSE
        IF (value.name.value <> 'T') AND (value.name.value <> 'F') THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid WRITE_ACCESS in MOUNT_STORAGE_MEDIUM command.', status);
          EXIT /main_program/; {----->
        ELSE
          IF value.name.value = 'T' THEN
            write_access := TRUE;
          ELSE
            write_access := FALSE;
          IFEND;
        IFEND;
      IFEND;

      clp$get_value ('WAIT_FOR_ATTACHMENT', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF value.kind <> clc$name_value THEN
        osp$set_status_abnormal (cmc$configuration_management_id, 0,
              'Invalid WAIT_FOR_ATTACHMENT in MOUNT_STORAGE_MEDIUM command.', status);
        EXIT /main_program/; {----->
      ELSE
        IF (value.name.value <> 'T') AND (value.name.value <> 'F') THEN
          osp$set_status_abnormal (cmc$configuration_management_id, 0,
                'Invalid WAIT_FOR_ATTACHMENT in MOUNT_STORAGE_MEDIUM command.', status);
          EXIT /main_program/; {----->
        ELSE
          IF value.name.value = 'T' THEN
            wait_for_attachment.wait := osc$wait;
          ELSE
            wait_for_attachment.wait := osc$nowait;
          IFEND;
        IFEND;
      IFEND;

      msp$mount_storage_medium (storage_device, medium, write_access, wait_for_attachment, status);

    END /main_program/;

  PROCEND msp$mount_storage_command;

?? TITLE := '  msp$validate_media_command', EJECT ??

  PROCEDURE msp$validate_media_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE validate_media_pdt (
{   element_name, n: name = $required
{   access, a: key
{       (dedicated_access, da, dedicated, d)
{       (concurrent_access, ca, concurrent, c)
{     keyend = $required
{   status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 5] of clt$pdt_parameter_name,
      parameters: array [1 .. 3] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 8] of clt$keyword_specification,
      recend,
      type3: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [103, 11, 4, 15, 35, 58, 298],
    clc$command, 5, 3, 2, 0, 0, 0, 3, ''], [
    ['A                              ',clc$abbreviation_entry, 2],
    ['ACCESS                         ',clc$nominal_entry, 2],
    ['ELEMENT_NAME                   ',clc$nominal_entry, 1],
    ['N                              ',clc$abbreviation_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 3]],
    [
{ PARAMETER 1
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 5, clc$required_parameter, 0
  , 0],
{ PARAMETER 2
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 303,
  clc$required_parameter, 0, 0],
{ PARAMETER 3
    [5, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 2
    [[1, 0, clc$keyword_type], [8], [
    ['C                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['CA                             ', clc$alias_entry, clc$normal_usage_entry, 2],
    ['CONCURRENT                     ', clc$alias_entry, clc$normal_usage_entry, 2],
    ['CONCURRENT_ACCESS              ', clc$nominal_entry, clc$normal_usage_entry, 2],
    ['D                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['DA                             ', clc$alias_entry, clc$normal_usage_entry, 1],
    ['DEDICATED                      ', clc$alias_entry, clc$normal_usage_entry, 1],
    ['DEDICATED_ACCESS               ', clc$nominal_entry, clc$normal_usage_entry, 1]]
    ],
{ PARAMETER 3
    [[1, 0, clc$status_type]]];

?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$element_name = 1,
      p$access = 2,
      p$status = 3;

    VAR
      pvt: array [1 .. 3] of clt$parameter_value;

    VAR
      access: mst$access_type;

    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    IF pvt[p$access].value^.keyword_value = 'DEDICATED_ACCESS' THEN
      access := msc$dedicated_access;
    ELSE
      access := msc$concurrent_access;
    IFEND;

      msp$validate_media_access (pvt [p$element_name].value^.name_value,
  access, status);

  PROCEND msp$validate_media_command;

?? TITLE := '  msp$execute_pp_command', EJECT ??

  PROCEDURE msp$execute_pp_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{      PDT execute_pp_pdt (
{        pp : LIST 1 .. 2 OF name = $required
{        iou : LIST 1 .. 2 OF name = IOU0
{        channel, c : LIST 1 .. 2 OF name = $optional
{        equipment_number, en : LIST 1 .. 2 OF integer 0 .. 7 = $optional
{        unit_number , un : LIST 1 .. 2 OF integer 0 .. 63 = $optional
{        object_library, ol : file
{        iou_program_name, ioupn, ipn : LIST 1 .. 2 OF name = $required
{        status)

?? PUSH (LISTEXT := ON) ??

    VAR
      execute_pp_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^execute_pp_pdt_names, ^execute_pp_pdt_params];

    VAR
      execute_pp_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 14] of
            clt$parameter_name_descriptor := [['PP', 1], ['IOU', 2], ['CHANNEL', 3], ['C', 3],
            ['EQUIPMENT_NUMBER', 4], ['EN', 4], ['UNIT_NUMBER', 5], ['UN', 5], ['OBJECT_LIBRARY', 6],
            ['OL', 6], ['IOU_PROGRAM_NAME', 7], ['IOUPN', 7], ['IPN', 7], ['STATUS', 8]];

    VAR
      execute_pp_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 8] of
            clt$parameter_descriptor := [

{ PP }
      [[clc$required], 1, 2, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ IOU }
      [[clc$optional_with_default, ^execute_pp_pdt_dv2], 1, 2, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ CHANNEL C }
      [[clc$optional], 1, 2, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ EQUIPMENT_NUMBER EN }
      [[clc$optional], 1, 2, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 0, 7]],

{ UNIT_NUMBER UN }
      [[clc$optional], 1, 2, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 0, 63]],

{ OBJECT_LIBRARY OL }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$file_value]],

{ IOU_PROGRAM_NAME IOUPN IPN }
      [[clc$required], 1, 2, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      execute_pp_pdt_dv2: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

?? POP ??

    CONST
      default_page_size = 4096;

    VAR
      channel_descriptor: cmt$channel_descriptor,
      channel_definition: cmt$data_channel_definition,
      local_status: ost$status,
      specified,
      unit_specified: boolean,
      i,
      j,
      pp_count,
      element_access_count: 0 .. clc$max_value_sets,
      pp_descriptor: cmt$pp_descriptor,
      pp_definition: cmt$pp_definition,
      pp: dst$iou_resource,
      value: clt$value,
      object_library_file: amt$local_file_name,
      object_library: ^SEQ ( * ),
      address: pmt$object_library_address,
      program_name: pmt$program_name,
      pp_program_description: ^array [1 .. * ] of cmt$pp_program_description,
      ioun: array [1 .. 2] of cmt$element_name,
      object_library_fid: amt$file_identifier;

    status.normal := TRUE;

  /main_program/
    BEGIN

      clp$scan_parameter_list (parameter_list, execute_pp_pdt, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('OBJECT_LIBRARY', specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF specified THEN
        clp$get_value ('OBJECT_LIBRARY', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        object_library_file := value.file.local_file_name;
        IF object_library_file <> '$NULL' THEN
          pmp$open_object_library (object_library_file, object_library_fid, object_library, status);
          IF NOT status.normal THEN
            EXIT /main_program/; {----->
          IFEND;
        IFEND;
      IFEND;

      clp$get_set_count ('PP', pp_count, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      PUSH pp_program_description: [1 .. pp_count];

      FOR i := 1 TO pp_count DO
        clp$get_value ('IOU', i, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        ioun [i] := value.name.value;
      FOREND;

      FOR i := 1 TO pp_count DO
        clp$get_value ('PP', i, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        pp_descriptor.iou := ioun [i];
        pp_descriptor.use_logical_identification := TRUE;
        pp_descriptor.pp_name := value.name.value;
        cmp$get_pp_definition (pp_descriptor, pp_definition, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        pp.number := pp_definition.number;
        IF pp_definition.concurrent THEN
          pp.channel_protocol := dsc$cpt_cio;
        ELSE
          pp.channel_protocol := dsc$cpt_nio;
        IFEND;
        cmp$convert_iou_name (ioun [i], pp.iou_number, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        pp_program_description^ [i].pp_identification.iou := ioun [i];
        cmp$convert_pp_number (pp, pp_program_description^ [i].pp_identification.ordinal);
        clp$get_value ('IOU_PROGRAM_NAME', i, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        pp_program_description^ [i].iou_program_name := value.name.value;
        IF specified AND (object_library_file <> '$NULL') THEN
          program_name := value.name.value;
          pmp$find_module_in_library (program_name, object_library, address, status);
          IF NOT status.normal THEN
            EXIT /main_program/; {----->
          IFEND;
          IF address.kind <> llc$ppu_object_module THEN
            osp$set_status_abnormal (cmc$configuration_management_id, 0,
                  'Illegal PP program in object library.', status);
            EXIT /main_program/; {----->
          IFEND;
          pp_program_description^ [i].pp_program := address.ppu_object_module;
        ELSE
          pp_program_description^ [i].pp_program := NIL;
        IFEND;
        pp_program_description^ [i].master_pp := (i = 1);
        pp_program_description^ [i].element_access := NIL;
        pp_program_description^ [i].communication_buffer_length := default_page_size;

      FOREND;

      clp$test_parameter ('UNIT_NUMBER', unit_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('CHANNEL', specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF specified THEN
        clp$get_set_count ('CHANNEL', element_access_count, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;

        FOR i := 1 TO pp_count DO
          PUSH pp_program_description^ [i].element_access: [1 .. element_access_count];
          FOR j := 1 TO element_access_count DO
            pp_program_description^ [i].element_access^ [j].iou := ioun [i];

            clp$get_value ('CHANNEL', j, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;
            channel_descriptor.iou := ioun [i];
            channel_descriptor.use_logical_identification := TRUE;
            channel_descriptor.name := value.name.value;
            cmp$get_channel_definition (channel_descriptor, channel_definition, status);
            IF NOT status.normal THEN
              IF status.condition = cme$lcm_element_not_found THEN
                status.normal := TRUE;
              ELSE
                EXIT /main_program/; {----->
              IFEND;
            IFEND;
            pp_program_description^ [i].element_access^ [j].channel.ordinal := channel_definition.ordinal;
            clp$get_value ('EQUIPMENT_NUMBER', j, 1, clc$low, value, status);
            IF NOT status.normal THEN
              EXIT /main_program/; {----->
            IFEND;
            pp_program_description^ [i].element_access^ [j].channel_address := value.int.value;

            IF unit_specified THEN
              clp$get_value ('UNIT_NUMBER', j, 1, clc$low, value, status);
              IF NOT status.normal THEN
                EXIT /main_program/; {----->
              IFEND;
              pp_program_description^ [i].element_access^ [j].physical_address_specifier :=
                    -$cmt$physical_address_specifier [];
              pp_program_description^ [i].element_access^ [j].unit_address := value.int.value;
            ELSE
              pp_program_description^ [i].element_access^ [j].physical_address_specifier :=
                    $cmt$physical_address_specifier [cmc$iou, cmc$channel, cmc$channel_address];
            IFEND;
          FOREND;
        FOREND;
      IFEND;

      msp$execute_pp_program (pp_program_description^, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

    END /main_program/;

    pmp$close_object_library (object_library_fid, local_status);

  PROCEND msp$execute_pp_command;

?? TITLE := '  msp$idle_pp_command', EJECT ??

  PROCEDURE msp$idle_pp_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{  PDT idle_pp_pdt (
{     pp : name = $required
{     break_interlocks, bi : boolean
{     hardware_idle_pp, hip : boolean
{     iou : name = IOU0
{     status)

?? PUSH (LISTEXT := ON) ??

    VAR
      idle_pp_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^idle_pp_pdt_names, ^idle_pp_pdt_params];

    VAR
      idle_pp_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 7] of
            clt$parameter_name_descriptor := [['PP', 1], ['BREAK_INTERLOCKS', 2], ['BI', 2],
            ['HARDWARE_IDLE_PP', 3], ['HIP', 3], ['IOU', 4], ['STATUS', 5]];

    VAR
      idle_pp_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 5] of clt$parameter_descriptor := [

{ PP }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ BREAK_INTERLOCKS BI }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$boolean_value]],

{ HARDWARE_IDLE_PP HIP }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$boolean_value]],

{ IOU }
      [[clc$optional_with_default, ^idle_pp_pdt_dv4], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      idle_pp_pdt_dv4: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

?? POP ??

    VAR
      value: clt$value,
      pp: dst$iou_resource,
      pp_descriptor: cmt$pp_descriptor,
      pp_definition: cmt$pp_definition,
      parameter_specified,
      pp_software_idled,
      hardware_idle_pp,
      break_interlocks: boolean,
      i: cmt$pp_ordinal,
      ppn: cmt$pp_identification,
      actual_pp_memory_size: cmt$pp_memory_length,
      pp_registers: cmt$pp_registers,
      pp_memory_area: ^SEQ ( * );

    status.normal := TRUE;

  /main_program/
    BEGIN

      clp$scan_parameter_list (parameter_list, idle_pp_pdt, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$get_value ('IOU', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      ppn.iou := value.name.value;

      clp$get_value ('PP', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      pp_descriptor.iou := ppn.iou;
      pp_descriptor.use_logical_identification := TRUE;
      pp_descriptor.pp_name := value.name.value;
      cmp$get_pp_definition (pp_descriptor, pp_definition, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      pp.number := pp_definition.number;
      IF pp_definition.concurrent THEN
        pp.channel_protocol := dsc$cpt_cio;
      ELSE
        pp.channel_protocol := dsc$cpt_nio;
      IFEND;
      cmp$convert_iou_name (ppn.iou, pp.iou_number, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      cmp$convert_pp_number (pp, ppn.ordinal);

      break_interlocks := FALSE;

      clp$test_parameter ('BREAK_INTERLOCKS', parameter_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      IF parameter_specified THEN
        clp$get_value ('BREAK_INTERLOCKS', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        break_interlocks := value.bool.value;
      IFEND;

      hardware_idle_pp := FALSE;
      clp$test_parameter ('HARDWARE_IDLE_PP', parameter_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      IF parameter_specified THEN
        clp$get_value ('HARDWARE_IDLE_PP', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        hardware_idle_pp := value.bool.value;
      IFEND;

      msp$idle_pp (ppn, break_interlocks, hardware_idle_pp, NIL, actual_pp_memory_size, pp_registers,
            pp_software_idled, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF NOT pp_software_idled THEN
        osp$set_status_abnormal ('CM', 0, 'Unable to soft idle PP.', status);
      IFEND;
    END /main_program/;

  PROCEND msp$idle_pp_command;

?? TITLE := '  msp$resume_pp_command', EJECT ??

  PROCEDURE msp$resume_pp_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{  PDT resume_pp_pdt (
{    pp : name = $required
{    hardware_resume_pp,hrp : boolean
{    start_address, sa : integer = $required
{    iou : name = IOU0
{    status)

?? PUSH (LISTEXT := ON) ??

    VAR
      resume_pp_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^resume_pp_pdt_names, ^resume_pp_pdt_params];

    VAR
      resume_pp_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 7] of
            clt$parameter_name_descriptor := [['PP', 1], ['HARDWARE_RESUME_PP', 2], ['HRP', 2],
            ['START_ADDRESS', 3], ['SA', 3], ['IOU', 4], ['STATUS', 5]];

    VAR
      resume_pp_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 5] of clt$parameter_descriptor := [

{ PP }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ HARDWARE_RESUME_PP HRP }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$boolean_value]],

{ START_ADDRESS SA }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$integer_value, clc$min_integer, clc$max_integer]],

{ IOU }
      [[clc$optional_with_default, ^resume_pp_pdt_dv4], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      resume_pp_pdt_dv4: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

?? POP ??

    VAR
      ppn: cmt$pp_identification,
      i: cmt$pp_ordinal,
      parameter_specified,
      pp_software_resumed,
      hardware_resume_pp: boolean,
      pp: dst$iou_resource,
      pp_definition: cmt$pp_definition,
      pp_descriptor: cmt$pp_descriptor,
      pp_identification: cmt$pp_identification,
      value: clt$value,
      start_address: cmt$pp_memory_length;

    status.normal := TRUE;

  /main_program/
    BEGIN
      clp$scan_parameter_list (parameter_list, resume_pp_pdt, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$get_value ('IOU', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      ppn.iou := value.name.value;

      clp$get_value ('PP', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      pp_descriptor.iou := ppn.iou;
      pp_descriptor.use_logical_identification := TRUE;
      pp_descriptor.pp_name := value.name.value;
      cmp$get_pp_definition (pp_descriptor, pp_definition, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      pp.number := pp_definition.number;
      IF pp_definition.concurrent THEN
        pp.channel_protocol := dsc$cpt_cio;
      ELSE
        pp.channel_protocol := dsc$cpt_nio;
      IFEND;
      cmp$convert_iou_name (ppn.iou, pp.iou_number, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      cmp$convert_pp_number (pp, ppn.ordinal);

      clp$get_value ('START_ADDRESS', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      start_address := value.int.value;
      clp$test_parameter ('HARDWARE_RESUME_PP', parameter_specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      IF parameter_specified THEN
        clp$get_value ('HARDWARE_RESUME_PP', 1, 1, clc$low, value, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        hardware_resume_pp := value.bool.value;
      ELSE
        hardware_resume_pp := FALSE;
      IFEND;
      msp$resume_pp (ppn, hardware_resume_pp, start_address, pp_software_resumed, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      { IF NOT pp_software_resumed THEN
      {   osp$set_status_abnormal ('CM', 0, 'Unable to software resume PP.',
      {      status);
      { IFEND;


    END /main_program/;



  PROCEND msp$resume_pp_command;

?? TITLE := '  msp$display_ppr_command', EJECT ??

  PROCEDURE msp$display_ppr_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{      PDT display_pp_pdt (
{         pp : name = $required
{         display_options, display_option, do : key A K P Q ALL = ALL
{         iou : name = IOU0
{         output, o : file = $output
{         status)

?? PUSH (LISTEXT := ON) ??

    VAR
      display_pp_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^display_pp_pdt_names, ^display_pp_pdt_params];

    VAR
      display_pp_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 8] of
            clt$parameter_name_descriptor := [['PP', 1], ['DISPLAY_OPTIONS', 2], ['DISPLAY_OPTION', 2],
            ['DO', 2], ['IOU', 3], ['OUTPUT', 4], ['O', 4], ['STATUS', 5]];

    VAR
      display_pp_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 5] of
            clt$parameter_descriptor := [

{ PP }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ DISPLAY_OPTIONS DISPLAY_OPTION DO }
      [[clc$optional_with_default, ^display_pp_pdt_dv2], 1, 1, 1, 1, clc$value_range_not_allowed,
            [^display_pp_pdt_kv2, clc$keyword_value]],

{ IOU }
      [[clc$optional_with_default, ^display_pp_pdt_dv3], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ OUTPUT O }
      [[clc$optional_with_default, ^display_pp_pdt_dv4], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$file_value]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      display_pp_pdt_kv2: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 5] of ost$name := ['A', 'K',
            'P', 'Q', 'ALL'];

    VAR
      display_pp_pdt_dv2: [STATIC, READ, cls$pdt_names_and_defaults] string (3) := 'ALL';

    VAR
      display_pp_pdt_dv3: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

    VAR
      display_pp_pdt_dv4: [STATIC, READ, cls$pdt_names_and_defaults] string (7) := '$output';

?? POP ??

    VAR
      a_register,
      k_register,
      p_register,
      q_register: ost$string,
      fid: amt$file_identifier,
      byte_address: amt$file_byte_address,
      len: integer,
      pp: dst$iou_resource,
      pp_descriptor: cmt$pp_descriptor,
      pp_definition: cmt$pp_definition,
      pp_identification: cmt$pp_identification,
      pp_registers: cmt$pp_registers,
      str: string (80),
      value: clt$value;

    status.normal := TRUE;

  /main_program/
    BEGIN
      clp$scan_parameter_list (parameter_list, display_pp_pdt, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$get_value ('OUTPUT', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      fsp$open_file (value.file.local_file_name, amc$record, NIL, NIL, NIL, NIL, NIL, fid, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      clp$get_value ('IOU', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      pp_identification.iou := value.name.value;

      clp$get_value ('PP', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      pp_descriptor.iou := pp_identification.iou;
      pp_descriptor.use_logical_identification := TRUE;
      pp_descriptor.pp_name := value.name.value;
      cmp$get_pp_definition (pp_descriptor, pp_definition, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      pp.number := pp_definition.number;
      IF pp_definition.concurrent THEN
        pp.channel_protocol := dsc$cpt_cio;
      ELSE
        pp.channel_protocol := dsc$cpt_nio;
      IFEND;
      cmp$convert_iou_name (pp_descriptor.iou, pp.iou_number, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      cmp$convert_pp_number (pp, pp_identification.ordinal);


      msp$get_pp_registers (pp_identification, pp_registers, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$convert_integer_to_string (pp_registers.a_register, 8, TRUE, a_register, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      clp$convert_integer_to_string (pp_registers.k_register, 8, TRUE, k_register, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      clp$convert_integer_to_string (pp_registers.p_register, 8, TRUE, p_register, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      clp$convert_integer_to_string (pp_registers.q_register, 8, TRUE, q_register, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      str := ' ';
      str (1, 14) := ' A Register : ';
      str (16, * ) := a_register.value (1, a_register.size);
      amp$put_next (fid, ^str, 80, byte_address, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      str := ' ';
      str (1, 14) := ' K Register : ';
      str (16, * ) := k_register.value (1, k_register.size);
      amp$put_next (fid, ^str, 80, byte_address, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      str := ' ';
      str (1, 14) := ' P Register : ';
      str (16, * ) := p_register.value (1, p_register.size);
      amp$put_next (fid, ^str, 80, byte_address, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      str := ' ';
      str (1, 14) := ' Q Register : ';
      str (16, * ) := q_register.value (1, q_register.size);
      amp$put_next (fid, ^str, 80, byte_address, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      fsp$close_file (fid, status);

    END /main_program/;

  PROCEND msp$display_ppr_command;

?? TITLE := '  msp$quit_command', EJECT ??

  PROCEDURE msp$quit_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{ PDT quit_pdt (  )

?? PUSH (LISTEXT := ON) ??

    VAR
      quit_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table := [NIL, NIL];

?? POP ??

    clp$end_scan_command_file (msv$utility_name, status);


  PROCEND msp$quit_command;

?? TITLE := ' msp$display_channel_command', EJECT ??

  PROCEDURE msp$display_channel_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{     PDT dis_channel_info (
{       channel_name, n : name = $optional
{       channel_number, cn : INTEGER = $optional
{       concurrent, c : BOOLEAN = FALSE
{       port, p : key A B = $optional
{       iou_name, iou : name = IOU0
{       output, o : file = $output
{       status)

?? PUSH (LISTEXT := ON) ??

    VAR
      dis_channel_info: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^dis_channel_info_names, ^dis_channel_info_params];

    VAR
      dis_channel_info_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 13] of
            clt$parameter_name_descriptor := [['CHANNEL_NAME', 1], ['N', 1], ['CHANNEL_NUMBER', 2], ['CN', 2],
            ['CONCURRENT', 3], ['C', 3], ['PORT', 4], ['P', 4], ['IOU_NAME', 5], ['IOU', 5], ['OUTPUT', 6],
            ['O', 6], ['STATUS', 7]];

    VAR
      dis_channel_info_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 7] of
            clt$parameter_descriptor := [

{ CHANNEL_NAME N }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ CHANNEL_NUMBER CN }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$integer_value, clc$min_integer, clc$max_integer]],

{ CONCURRENT C }
      [[clc$optional_with_default, ^dis_channel_info_dv3], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$boolean_value]],

{ PORT P }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [^dis_channel_info_kv4, clc$keyword_value]],

{ IOU_NAME IOU }
      [[clc$optional_with_default, ^dis_channel_info_dv5], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ OUTPUT O }
      [[clc$optional_with_default, ^dis_channel_info_dv6], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$file_value]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      dis_channel_info_kv4: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 2] of
            ost$name := ['A', 'B'];

    VAR
      dis_channel_info_dv3: [STATIC, READ, cls$pdt_names_and_defaults] string (5) := 'FALSE';

    VAR
      dis_channel_info_dv5: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

    VAR
      dis_channel_info_dv6: [STATIC, READ, cls$pdt_names_and_defaults] string (7) := '$output';

?? POP ??

    VAR
      pen: cmt$physical_equipment_number,
      ppn: ost$physical_pp_number,
      output_file_val: clt$value,
      output: amt$local_file_name,
      fid: amt$file_identifier,
      channel_name: cmt$element_name,
      channel_port: cmt$channel_port,
      ba: amt$file_byte_address,
      valid: boolean,
      value: clt$value,
      len: integer,
      str: string (50),
      specified: boolean,
      local_status: ost$status,
      element_descriptor: cmt$element_descriptor,
      element_definition: cmt$element_definition,
      channel_definition: cmt$data_channel_definition,
      channel_descriptor: cmt$channel_descriptor;

    status.normal := TRUE;

  /main_program/
    BEGIN
      clp$scan_parameter_list (parameter_list, dis_channel_info, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('CHANNEL_NAME', specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF specified THEN
        clp$get_value ('CHANNEL_NAME', 1, 1, clc$low, value, status);
        channel_descriptor.use_logical_identification := TRUE;
        channel_descriptor.name := value.name.value;
      ELSE
        clp$get_value ('CHANNEL_NUMBER', 1, 1, clc$low, value, status);
        channel_descriptor.use_logical_identification := FALSE;
        IF (value.int.value < 0) OR (value.int.value >= 27) THEN
          osp$set_status_abnormal (cmc$configuration_management_id, cme$invalid_channel_number,
                'Channel number is out of range', status);
          EXIT /main_program/; {----->
        IFEND;
        channel_descriptor.number := value.int.value;
        clp$get_value ('CONCURRENT', 1, 1, clc$low, value, status);
        channel_descriptor.concurrent := value.bool.value;
        clp$test_parameter ('PORT', specified, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        IF specified THEN
          clp$get_value ('PORT', 1, 1, clc$low, value, status);
          IF value.name.value = 'A' THEN
            channel_port := cmc$port_a;
          ELSE
            channel_port := cmc$port_b;
          IFEND;
        ELSE
          channel_port := cmc$unspecified_port;
        IFEND;
        cmp$convert_channel_number (channel_descriptor.number, channel_descriptor.concurrent, channel_port,
              channel_descriptor.channel_ordinal, channel_name, valid);
      IFEND;

      clp$get_value ('IOU_NAME', 1, 1, clc$low, value, status);
      channel_descriptor.iou := value.name.value;

      clp$get_value ('OUTPUT', 1, 1, clc$low, output_file_val, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      amp$open (output_file_val.file.local_file_name, amc$record, NIL, fid, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      element_descriptor.element_type := cmc$data_channel_element;
      element_descriptor.channel_descriptor := channel_descriptor;
      cmp$get_element_definition (element_descriptor, element_definition, status);
      IF NOT status.normal THEN
        IF status.condition = cme$lcm_element_not_found THEN
          status.normal := TRUE;
          cmp$get_channel_definition (channel_descriptor, channel_definition, status);
          IF NOT status.normal THEN
            IF status.condition = cme$lcm_element_not_found THEN
              status.normal := TRUE;
            ELSE
              EXIT /main_program/; {----->
            IFEND;
          IFEND;
        ELSE
          EXIT /main_program/; {----->
        IFEND;
      ELSE
        IF element_definition.element_type = cmc$data_channel_element THEN
          channel_definition := element_definition.data_channel;
        ELSE
          str (1, 50) := ' ';
          STRINGREP (str, len, ' WRONG ELEMENT_TYPE FOR: ', element_definition.element_name);
          amp$put_next (fid, #LOC (str), len, ba, status);
          EXIT /main_program/; {----->
        IFEND;
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' CHANNEL_NUMBER : ', channel_definition.number);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      IF channel_definition.concurrent THEN
        STRINGREP (str, len, ' CONCURRENT : TRUE');
      ELSE
        STRINGREP (str, len, ' CONCURRENT : FALSE');
      IFEND;
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      IF channel_definition.direct_memory_access THEN
        STRINGREP (str, len, ' DMA : TRUE');
      ELSE
        STRINGREP (str, len, ' DMA : FALSE');
      IFEND;
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' IOU_NAME : ', channel_definition.iou);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' CHANNEL_KIND : ', channel_definition.kind);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' CHANNEL_ORDINAL : ', channel_definition.ordinal);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' CHANNEL_PORT : ', channel_definition.port);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      FOR pen := LOWERVALUE (cmt$physical_equipment_number) TO UPPERVALUE (cmt$physical_equipment_number) DO
        IF channel_definition.connection.equipment [pen].configured THEN
          str (1, 50) := ' ';
          STRINGREP (str, len, ' EQUIPMENT_', pen, ' : ', channel_definition.connection.equipment [pen].
                element_name);
          amp$put_next (fid, #LOC (str), len, ba, status);
          IF NOT status.normal THEN
            EXIT /main_program/; {----->
          IFEND;
        IFEND;
      FOREND;

      FOR ppn := LOWERVALUE (ost$physical_pp_number) TO UPPERVALUE (ost$physical_pp_number) DO
        str (1, 50) := ' ';
        STRINGREP (str, len, ' PP_ACCESS_', ppn, ' : ', channel_definition.pps_capable_of_access [ppn]);
        amp$put_next (fid, #LOC (str), len, ba, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
      FOREND;

    END /main_program/;

    amp$close (fid, local_status);

  PROCEND msp$display_channel_command;

  PROCEDURE msp$display_iou_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{  PDT dis_iou_info (
{        iou : name = IOU0
{        output, o : file = OUTPUT
{        status)

?? PUSH (LISTEXT := ON) ??

    VAR
      dis_iou_info: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^dis_iou_info_names, ^dis_iou_info_params];

    VAR
      dis_iou_info_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 4] of
            clt$parameter_name_descriptor := [['IOU', 1], ['OUTPUT', 2], ['O', 2], ['STATUS', 3]];

    VAR
      dis_iou_info_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 3] of clt$parameter_descriptor := [

{ IOU }
      [[clc$optional_with_default, ^dis_iou_info_dv1], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ OUTPUT O }
      [[clc$optional_with_default, ^dis_iou_info_dv2], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$file_value]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      dis_iou_info_dv1: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

    VAR
      dis_iou_info_dv2: [STATIC, READ, cls$pdt_names_and_defaults] string (6) := 'OUTPUT';

?? POP ??

    VAR
      iou_name: cmt$element_name,
      output_file_val: clt$value,
      output: amt$local_file_name,
      fid: amt$file_identifier,
      ba: amt$file_byte_address,
      value: clt$value,
      len: integer,
      str: string (50),
      local_status: ost$status,
      iou_definition: cmt$iou_definition;

    status.normal := TRUE;

  /main_program/
    BEGIN
      clp$scan_parameter_list (parameter_list, dis_iou_info, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$get_value ('OUTPUT', 1, 1, clc$low, output_file_val, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$get_value ('IOU', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      iou_name := value.name.value;
      amp$open (output_file_val.file.local_file_name, amc$record, NIL, fid, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      cmp$get_iou_definition (iou_name, iou_definition, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' IOU_KIND : ', iou_definition.kind);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

    END /main_program/;

    amp$close (fid, local_status);

  PROCEND msp$display_iou_command;

  PROCEDURE msp$display_ppd_command
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{     PDT dis_pp_info (
{       pp_name, n : name = $optional
{       pp_number, ppn : INTEGER = $optional
{       concurrent, c : BOOLEAN = FALSE
{       iou_name, iou : name = IOU0
{       output, o : file = $output
{       status)

?? PUSH (LISTEXT := ON) ??

    VAR
      dis_pp_info: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table :=
            [^dis_pp_info_names, ^dis_pp_info_params];

    VAR
      dis_pp_info_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 11] of
            clt$parameter_name_descriptor := [['PP_NAME', 1], ['N', 1], ['PP_NUMBER', 2], ['PPN', 2],
            ['CONCURRENT', 3], ['C', 3], ['IOU_NAME', 4], ['IOU', 4], ['OUTPUT', 5], ['O', 5], ['STATUS', 6]];

    VAR
      dis_pp_info_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 6] of clt$parameter_descriptor := [

{ PP_NAME N }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ PP_NUMBER PPN }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$integer_value, -9223372036854775806, 9223372036854775807]],

{ CONCURRENT C }
      [[clc$optional_with_default, ^dis_pp_info_dv3], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$boolean_value]],

{ IOU_NAME IOU }
      [[clc$optional_with_default, ^dis_pp_info_dv4], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ OUTPUT O }
      [[clc$optional_with_default, ^dis_pp_info_dv5], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$file_value]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      dis_pp_info_dv3: [STATIC, READ, cls$pdt_names_and_defaults] string (5) := 'FALSE';

    VAR
      dis_pp_info_dv4: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

    VAR
      dis_pp_info_dv5: [STATIC, READ, cls$pdt_names_and_defaults] string (7) := '$output';

?? POP ??

    VAR
      chn: ost$physical_channel_number,
      output_file_val: clt$value,
      output: amt$local_file_name,
      fid: amt$file_identifier,
      ba: amt$file_byte_address,
      value: clt$value,
      len: integer,
      str: string (50),
      specified: boolean,
      local_status: ost$status,
      pp_definition: cmt$pp_definition,
      pp_descriptor: cmt$pp_descriptor;

    status.normal := TRUE;

  /main_program/
    BEGIN
      clp$scan_parameter_list (parameter_list, dis_pp_info, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$test_parameter ('PP_NAME', specified, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      IF specified THEN
        clp$get_value ('PP_NAME', 1, 1, clc$low, value, status);
        pp_descriptor.use_logical_identification := TRUE;
        pp_descriptor.pp_name := value.name.value;
      ELSE
        clp$get_value ('PP_NUMBER', 1, 1, clc$low, value, status);
        pp_descriptor.use_logical_identification := FALSE;
        pp_descriptor.pp_number := value.int.value;

        clp$get_value ('CONCURRENT', 1, 1, clc$low, value, status);
        pp_descriptor.concurrent := value.bool.value;
      IFEND;

      clp$get_value ('IOU_NAME', 1, 1, clc$low, value, status);
      pp_descriptor.iou := value.name.value;

      clp$get_value ('OUTPUT', 1, 1, clc$low, output_file_val, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      amp$open (output_file_val.file.local_file_name, amc$record, NIL, fid, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      cmp$get_pp_definition (pp_descriptor, pp_definition, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' PP_NUMBER : ', pp_definition.number);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      IF pp_definition.concurrent THEN
        STRINGREP (str, len, ' CONCURRENT : TRUE');
      ELSE
        STRINGREP (str, len, ' CONCURRENT : FALSE');
      IFEND;
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      IF pp_definition.direct_memory_access THEN
        STRINGREP (str, len, ' DMA : TRUE');
      ELSE
        STRINGREP (str, len, ' DMA : FALSE');
      IFEND;
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' IOU_NAME : ', pp_definition.iou);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      str (1, 50) := ' ';
      STRINGREP (str, len, ' SIZE : ', pp_definition.size);
      amp$put_next (fid, #LOC (str), len, ba, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      FOR chn := LOWERVALUE (ost$physical_channel_number) TO UPPERVALUE (ost$physical_channel_number) DO
        str (1, 50) := ' ';
        STRINGREP (str, len, ' CHANNEL_ACCESS_', chn, ' : ', pp_definition.accessible_channels [chn]);
        amp$put_next (fid, #LOC (str), len, ba, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
      FOREND;

    END /main_program/;

    amp$close (fid, local_status);

  PROCEND msp$display_ppd_command;

?? TITLE := '    msp$test_return_descriptor_data', EJECT ??

  PROCEDURE msp$test_return_descriptor_data
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{  PDT test_rdd (
{       logical_unit_number, lun : integer 2 .. 0ffff(16) = $required
{       channel, c : name = $required
{       iou : name = IOU0
{       system_element, se : boolean = TRUE
{       equipment_number, en : integer 0 .. 7 = 0
{       status)

?? PUSH (LISTEXT := ON) ??

    VAR
      test_rdd: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table := [^test_rdd_names, ^test_rdd_params];

    VAR
      test_rdd_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 10] of
            clt$parameter_name_descriptor := [['LOGICAL_UNIT_NUMBER', 1], ['LUN', 1], ['CHANNEL', 2],
            ['C', 2], ['IOU', 3], ['SYSTEM_ELEMENT', 4], ['SE', 4], ['EQUIPMENT_NUMBER', 5], ['EN', 5],
            ['STATUS', 6]];

    VAR
      test_rdd_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 6] of clt$parameter_descriptor := [

{ LOGICAL_UNIT_NUMBER LUN }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$integer_value, 2, 0ffff(16)]],

{ CHANNEL C }
      [[clc$required], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$name_value, 1, osc$max_name_size]],

{ IOU }
      [[clc$optional_with_default, ^test_rdd_dv3], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$name_value, 1, osc$max_name_size]],

{ SYSTEM_ELEMENT SE }
      [[clc$optional_with_default, ^test_rdd_dv4], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$boolean_value]],

{ EQUIPMENT_NUMBER EN }
      [[clc$optional_with_default, ^test_rdd_dv5], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$integer_value, 0, 7]],

{ STATUS }
      [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed,
            [NIL, clc$variable_reference, clc$array_not_allowed, clc$status_value]]];

    VAR
      test_rdd_dv3: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'IOU0';

    VAR
      test_rdd_dv4: [STATIC, READ, cls$pdt_names_and_defaults] string (4) := 'TRUE';

    VAR
      test_rdd_dv5: [STATIC, READ, cls$pdt_names_and_defaults] string (1) := '0';

?? POP ??

    VAR
      ch: cmt$element_name,
      channel_descriptor: cmt$channel_descriptor,
      channel_definition: cmt$data_channel_definition,
      descriptor_data: ost$string,
      dummy_ppn: 0 .. 0ff(16),
      en: cmt$physical_equipment_number,
      iou: cmt$element_name,
      iou_number: dst$iou_number,
      lpp: iot$pp_number,
      lun: iot$logical_unit,
      physical_channel: cmt$physical_channel,
      physical_pp: 0 .. 31,
      value: clt$value,
      file: clt$file,
      display_control: clt$display_control;

  /main_program/
    BEGIN

      clp$scan_parameter_list (parameter_list, test_rdd, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      clp$get_value ('IOU', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      iou := value.name.value;
      cmp$convert_iou_name (iou, iou_number, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

      clp$get_value ('CHANNEL', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      channel_descriptor.iou := iou;
      channel_descriptor.use_logical_identification := TRUE;
      channel_descriptor.name := value.name.value;
      cmp$get_channel_definition (channel_descriptor, channel_definition, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      ch := value.name.value;
      physical_channel.number := channel_definition.number;
      physical_channel.port := channel_definition.port;
      physical_channel.concurrent := channel_definition.concurrent;
      clp$get_value ('EQUIPMENT_NUMBER', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      IF value.kind <> clc$unknown_value THEN
        en := value.int.value;
      ELSE
        en := 0;
      IFEND;
      clp$get_value ('LOGICAL_UNIT_NUMBER', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      lun := value.int.value;

      clp$get_value ('SYSTEM_ELEMENT', 1, 1, clc$low, value, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      IF value.bool.value THEN
        cmp$return_descriptor_data (physical_channel, iou_number, en, lun, descriptor_data, dummy_ppn);
      ELSE
        cmp$return_logical_pp_number (ch, iou, lpp, status);
        IF NOT status.normal THEN
          EXIT /main_program/; {----->
        IFEND;
        cmp$return_desc_data_by_lun_lpn (lun, lpp, iou_number, descriptor_data, physical_pp);
      IFEND;
      file.local_file_name := clc$standard_output;
      clp$open_display (file, NIL, display_control, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      clp$put_display (display_control, descriptor_data.value (1, descriptor_data.size), clc$no_trim, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;
      clp$close_display (display_control, status);
      IF NOT status.normal THEN
        EXIT /main_program/; {----->
      IFEND;

    END /main_program/;

  PROCEND msp$test_return_descriptor_data;

MODEND msm$maintenance_services_utl;
