?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE Object Code Management: Change Command Description' ??
MODULE ocm$change_command_description;

{
{ PURPOSE:
{   Change a command description on an object library.
{

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc clt$parameter_list
*copyc llt$command_description
*copyc oce$library_generator_errors
*copyc oct$new_library_module_list
*copyc ost$status
?? POP ??
*copyc avp$get_capability
*copyc clp$count_list_elements
*copyc clp$evaluate_parameters
*copyc i#current_sequence_position
*copyc ocp$close_all_open_files
*copyc ocp$initialize_olg_working_heap
*copyc ocp$search_nlm_tree
*copyc osp$set_status_abnormal
*copyc osp$set_status_condition
*copyc pmp$continue_to_cause
*copyc pmp$disestablish_cond_handler
*copyc pmp$establish_condition_handler
*copyc pmp$get_date
*copyc pmp$get_time
*copyc ocv$olg_scratch_seq
*copyc ocv$olg_working_heap
*copyc ocv$open_file_list
?? OLDTITLE ??
?? NEWTITLE := '[XDCL] ocp$_change_command_description', EJECT ??

  PROCEDURE [XDCL] ocp$_change_command_description
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (ocm$creol_chacd) change_command_description,
{      change_command_descriptions, chacd (
{   name, names, n: list of name = $required
{   starting_procedure, sp: (BY_NAME) program_name = $optional
{   library, l: (BY_NAME) any of
{       key
{         $unspecified, osf$current_library
{       keyend
{       file
{       string
{     anyend = $optional
{   system_command_name, scn: (BY_NAME) name = $optional
{   availability, a: (BY_NAME) key
{       (normal_usage, nu)
{       (advanced_usage, au)
{       (hidden, h)
{     keyend = $optional
{   scope, s: (BY_NAME) key
{       (xdcl, x)
{       (gate, g)
{       (local, l)
{     keyend = $optional
{   log_option, lo: (BY_NAME) key
{       (automatic, a)
{       (manual, m)
{     keyend = $optional
{   application_identifier, ai: (BY_NAME, ADVANCED) any of
{       key
{         $unspecified
{       keyend
{       name
{     anyend = $optional
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 18] of clt$pdt_parameter_name,
      parameters: array [1 .. 9] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 2] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
        recend,
        type_size_3: clt$type_specification_size,
        element_type_spec_3: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
      recend,
      type4: record
        header: clt$type_specification_header,
        qualifier: clt$name_type_qualifier,
      recend,
      type5: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 6] of clt$keyword_specification,
      recend,
      type6: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 6] of clt$keyword_specification,
      recend,
      type7: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
      recend,
      type8: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 1] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
      type9: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [89, 9, 12, 14, 58, 13, 214],
    clc$command, 18, 9, 1, 1, 0, 0, 9, 'OCM$CREOL_CHACD'], [
    ['A                              ',clc$abbreviation_entry, 5],
    ['AI                             ',clc$abbreviation_entry, 8],
    ['APPLICATION_IDENTIFIER         ',clc$nominal_entry, 8],
    ['AVAILABILITY                   ',clc$nominal_entry, 5],
    ['L                              ',clc$abbreviation_entry, 3],
    ['LIBRARY                        ',clc$nominal_entry, 3],
    ['LO                             ',clc$abbreviation_entry, 7],
    ['LOG_OPTION                     ',clc$nominal_entry, 7],
    ['N                              ',clc$abbreviation_entry, 1],
    ['NAME                           ',clc$nominal_entry, 1],
    ['NAMES                          ',clc$alias_entry, 1],
    ['S                              ',clc$abbreviation_entry, 6],
    ['SCN                            ',clc$abbreviation_entry, 4],
    ['SCOPE                          ',clc$nominal_entry, 6],
    ['SP                             ',clc$abbreviation_entry, 2],
    ['STARTING_PROCEDURE             ',clc$nominal_entry, 2],
    ['STATUS                         ',clc$nominal_entry, 9],
    ['SYSTEM_COMMAND_NAME            ',clc$nominal_entry, 4]],
    [
{ PARAMETER 1
    [10, 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, 21, clc$required_parameter, 0, 0],
{ PARAMETER 2
    [16, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$optional_parameter, 0, 0],
{ PARAMETER 3
    [6, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 116, clc$optional_parameter, 0, 0],
{ PARAMETER 4
    [18, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 5, clc$optional_parameter, 0, 0],
{ PARAMETER 5
    [4, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 229, clc$optional_parameter, 0, 0],
{ PARAMETER 6
    [14, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 229, clc$optional_parameter, 0, 0],
{ PARAMETER 7
    [8, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 155, clc$optional_parameter, 0, 0],
{ PARAMETER 8
    [3, clc$advanced_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 69, clc$optional_parameter, 0, 0],
{ PARAMETER 9
    [17, 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$list_type], [5, 1, clc$max_list_size, FALSE],
      [[1, 0, clc$name_type], [1, osc$max_name_size]]
    ],
{ PARAMETER 2
    [[1, 0, clc$program_name_type]],
{ PARAMETER 3
    [[1, 0, clc$union_type], [[clc$file_type, clc$keyword_type,
    clc$string_type],
    FALSE, 3],
    81, [[1, 0, clc$keyword_type], [2], [
      ['$UNSPECIFIED                   ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
      ['OSF$CURRENT_LIBRARY            ', clc$nominal_entry,
  clc$normal_usage_entry, 2]]
      ],
    3, [[1, 0, clc$file_type]],
    8, [[1, 0, clc$string_type], [0, clc$max_string_size, FALSE]]
    ],
{ PARAMETER 4
    [[1, 0, clc$name_type], [1, osc$max_name_size]],
{ PARAMETER 5
    [[1, 0, clc$keyword_type], [6], [
    ['ADVANCED_USAGE                 ', clc$nominal_entry,
  clc$normal_usage_entry, 2],
    ['AU                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
    ['H                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 3],
    ['HIDDEN                         ', clc$nominal_entry,
  clc$normal_usage_entry, 3],
    ['NORMAL_USAGE                   ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
    ['NU                             ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1]]
    ],
{ PARAMETER 6
    [[1, 0, clc$keyword_type], [6], [
    ['G                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
    ['GATE                           ', clc$nominal_entry,
  clc$normal_usage_entry, 2],
    ['L                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 3],
    ['LOCAL                          ', clc$nominal_entry,
  clc$normal_usage_entry, 3],
    ['X                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1],
    ['XDCL                           ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
    ],
{ PARAMETER 7
    [[1, 0, clc$keyword_type], [4], [
    ['A                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 1],
    ['AUTOMATIC                      ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
    ['M                              ', clc$abbreviation_entry,
  clc$normal_usage_entry, 2],
    ['MANUAL                         ', clc$nominal_entry,
  clc$normal_usage_entry, 2]]
    ],
{ PARAMETER 8
    [[1, 0, clc$union_type], [[clc$keyword_type,
    clc$name_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['$UNSPECIFIED                   ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
      ],
    5, [[1, 0, clc$name_type], [1, osc$max_name_size]]
    ],
{ PARAMETER 9
    [[1, 0, clc$status_type]]];

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

    CONST
      p$name = 1,
      p$starting_procedure = 2,
      p$library = 3,
      p$system_command_name = 4,
      p$availability = 5,
      p$scope = 6,
      p$log_option = 7,
      p$application_identifier = 8,
      p$status = 9;

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

    CONST
      unspecified = '$UNSPECIFIED';

    VAR
      application_administrator: boolean,
      date: ost$date,
      ignore_status: ost$status,
      member: ^SEQ ( * ),
      member_size: ost$segment_length,
      module_description: ^oct$module_description,
      module_does_exist: boolean,
      name: clt$command_name,
      name_node: ^clt$data_value,
      new_alias_list: ^pmt$module_list,
      new_applic_command_header: ^llt$application_member_header,
      new_application_identifier: ^llt$application_identifier,
      new_command_description_content: ^llt$command_desc_contents,
      new_command_description_header: ^llt$library_member_header,
      new_library_parameter: ^fst$file_reference,
      new_library_path: ^fst$file_reference,
      nlm: ^oct$new_library_module_list,
      old_alias_list: ^pmt$module_list,
      old_application_identifier: ^llt$application_identifier,
      old_command_description_content: ^llt$command_desc_contents,
      old_command_description_header: ^llt$library_member_header,
      old_library_path: ^fst$file_reference,
      old_member: ^SEQ ( * ),
      old_seq: ^SEQ ( * ),
      sequence: ^SEQ ( * ),
      size: ost$segment_length,
      time: ost$time;

    VAR
      established_conditions: pmt$condition,
      established_descriptor: pmt$established_handler;

?? NEWTITLE := 'check_parameters', EJECT ??

{
{ This "check parameters procedure" verifies that command description
{ parameters specify information for either a "normal" command description
{ or a "system command description" but not both.
{

    PROCEDURE check_parameters
      (    pvt: ^clt$parameter_value_table;
           ignore_which_parameter: clt$which_parameter;
       VAR status: ost$status);


      status.normal := TRUE;

      IF pvt^ [p$system_command_name].specified AND (pvt^ [p$starting_procedure].
            specified OR pvt^ [p$library].specified) THEN
        osp$set_status_condition (oce$e_bad_command_desc_params, status);
      IFEND;

    PROCEND check_parameters;
?? OLDTITLE ??
?? NEWTITLE := 'condition_handler', EJECT ??

{ PURPOSE:
{   The purpose of this procedure is to handle the terminate break and
{   block exit conditions.

    PROCEDURE condition_handler
      (    condition: pmt$condition;
           condition_descriptor: ^pmt$condition_information;
           stack_frame_save_area_p: ^ost$stack_frame_save_area;
       VAR handler_status: ost$status);


      IF (condition.selector = ifc$interactive_condition) AND
            (condition.interactive_condition = ifc$terminate_break) THEN

{ Ignore the condition.

        RETURN;
      ELSEIF condition.selector = pmc$block_exit_processing THEN
        ocp$close_all_open_files (ocv$open_file_list);
        ocp$initialize_olg_working_heap;
        RESET ocv$olg_scratch_seq;
      ELSE
        pmp$continue_to_cause (pmc$execute_standard_procedure, handler_status);
      IFEND;

    PROCEND condition_handler;
?? OLDTITLE, EJECT ??

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

    IF pvt [p$application_identifier].specified THEN
      avp$get_capability (avc$application_administration, avc$user, application_administrator, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      IF NOT application_administrator THEN
        osp$set_status_condition (oce$not_application_administrtr, status);
        RETURN;
      IFEND;
    IFEND;

    established_conditions.selector := pmc$condition_combination;
    established_conditions.combination := $pmt$condition_combination
          [ifc$interactive_condition, pmc$block_exit_processing];
    pmp$establish_condition_handler (established_conditions, ^condition_handler, ^established_descriptor,
          status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

  /protect/
    BEGIN
      name_node := pvt [p$name].value;
      WHILE (name_node <> NIL) AND (name_node^.element_value <> NIL) DO
        name := name_node^.element_value^.name_value;

        ocp$search_nlm_tree (name, nlm, module_does_exist);
        IF NOT module_does_exist THEN
          osp$set_status_abnormal ('OC', oce$w_module_not_found, name, status);
          EXIT /protect/;
        IFEND;
        CASE nlm^.description^.kind OF
        = occ$command_description =
          old_command_description_header := nlm^.description^.command_description_header;
          old_application_identifier := NIL;
        = occ$applic_command_description =
          old_command_description_header := ^nlm^.description^.applic_command_description_hdr^.
                library_member_header;
          old_application_identifier := ^nlm^.description^.applic_command_description_hdr^.
                application_identifier;
        ELSE
          osp$set_status_abnormal ('OC', oce$e_module_not_a_command_desc, name, status);
          EXIT /protect/;
        CASEND;

        old_seq := nlm^.description^.file;
        RESET ocv$olg_scratch_seq;

        NEXT new_command_description_header IN ocv$olg_scratch_seq;
        IF new_command_description_header = NIL THEN
          osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
          RETURN;
        IFEND;

        new_command_description_header^ := old_command_description_header^;

{   Since an APPLICATION COMMAND DESCRIPTION is a record of:
{                llt$library_member_header,
{                llt$application_identifier,
{ processing of the APPLICATION_IDENTIFIER parameter must be done first after the
{ command description is set up so that the application identifier (llt$application_identifier)
{ immediately follows the command description (llt$library_member_header) in OCV$OLG_SCRATCH_SEQ.

        new_application_identifier := NIL;
        IF pvt [p$application_identifier].specified THEN
          IF pvt [p$application_identifier].value^.kind = clc$keyword {AND keyword = unspecified} THEN
            new_command_description_header^.kind := llc$command_description;
          ELSE {clc$name}
            NEXT new_application_identifier IN ocv$olg_scratch_seq;
            IF new_application_identifier = NIL THEN
              osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
              RETURN;
            IFEND;
            new_application_identifier^.name := pvt [p$application_identifier].value^.name_value;
            new_command_description_header^.kind := llc$applic_command_description;
          IFEND;
        ELSEIF old_application_identifier <> NIL THEN
          NEXT new_application_identifier IN ocv$olg_scratch_seq;
          IF new_application_identifier = NIL THEN
            osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
            RETURN;
          IFEND;
          new_application_identifier^.name := old_application_identifier^.name;
        IFEND;

        IF new_command_description_header^.number_of_aliases <> 0 THEN
          old_alias_list := #PTR (old_command_description_header^.aliases, old_seq^);
          NEXT new_alias_list: [1 .. new_command_description_header^.number_of_aliases] IN
                ocv$olg_scratch_seq;
          IF new_alias_list = NIL THEN
            osp$set_status_abnormal ('OC', oce$e_premature_eof_in_module, name, status);
            EXIT /protect/;
          IFEND;
          new_alias_list^ := old_alias_list^;
        IFEND;

        old_member := #PTR (old_command_description_header^.member, old_seq^);
        RESET old_member;
        NEXT old_command_description_content IN old_member;
        IF old_command_description_content = NIL THEN
          osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
          RETURN;
        IFEND;
        NEXT new_command_description_content IN ocv$olg_scratch_seq;
        IF new_command_description_content = NIL THEN
          osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
          RETURN;
        IFEND;
        new_command_description_content^ := old_command_description_content^;

        IF pvt [p$system_command_name].specified THEN
          new_command_description_content^.system_command := TRUE;
          new_command_description_content^.system_command_name :=
                pvt [p$system_command_name].value^.name_value;

        ELSE
          IF pvt [p$starting_procedure].specified THEN
            new_command_description_content^.system_command := FALSE;
            new_command_description_content^.starting_procedure :=
                  pvt [p$starting_procedure].value^.program_name_value;
          IFEND;

          IF old_command_description_content^.system_command THEN
            PUSH old_library_path: [0];
          ELSE
            NEXT old_library_path: [old_command_description_content^.library_path_size] IN old_member;
            IF old_library_path = NIL THEN
              osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
              RETURN;
            IFEND;
          IFEND;

          IF pvt [p$library].specified THEN
            IF old_command_description_content^.system_command AND (NOT pvt [p$starting_procedure].specified)
                  THEN
              osp$set_status_condition (oce$e_bad_command_desc_params, status);
              EXIT /protect/;
            IFEND;
            CASE pvt [p$library].value^.kind OF
            = clc$keyword =
              IF pvt [p$library].value^.keyword_value = unspecified THEN
                PUSH new_library_parameter: [0];
              ELSE {OSF$CURRENT_LIBRARY}
                new_library_parameter := ^pvt [p$library].value^.keyword_value;
              IFEND;
            = clc$file =
              new_library_parameter := pvt [p$library].value^.file_value;
            ELSE {clc$string}
              new_library_parameter := pvt [p$library].value^.string_value;
            CASEND;
            IF STRLENGTH (new_library_parameter^) >= fsc$max_path_size THEN
              new_command_description_content^.library_path_size := fsc$max_path_size;
            ELSE
              new_command_description_content^.library_path_size := STRLENGTH (new_library_parameter^);
            IFEND;
            NEXT new_library_path: [new_command_description_content^.library_path_size] IN
                  ocv$olg_scratch_seq;
            IF new_library_path = NIL THEN
              osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
              RETURN;
            IFEND;
            new_library_path^ := new_library_parameter^;

          ELSEIF STRLENGTH (old_library_path^) > 0 THEN
            NEXT new_library_path: [STRLENGTH (old_library_path^)] IN ocv$olg_scratch_seq;
            IF new_library_path = NIL THEN
              osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
              RETURN;
            IFEND;
            new_library_path^ := old_library_path^;
          IFEND;
        IFEND;

        IF pvt [p$availability].specified THEN
          IF pvt [p$availability].value^.keyword_value = 'NORMAL_USAGE' THEN
            new_command_description_header^.command_function_availability := clc$normal_usage_entry;
          ELSEIF pvt [p$availability].value^.keyword_value = 'ADVANCED_USAGE' THEN
            new_command_description_header^.command_function_availability := clc$advanced_usage_entry;
          ELSE {HIDDEN}
            new_command_description_header^.command_function_availability := clc$hidden_entry;
          IFEND;
        IFEND;

        IF pvt [p$scope].specified THEN
          IF pvt [p$scope].value^.keyword_value = 'XDCL' THEN
            new_command_description_header^.command_function_kind := llc$entry_point;
          ELSEIF pvt [p$scope].value^.keyword_value = 'GATE' THEN
            new_command_description_header^.command_function_kind := llc$gate;
          ELSE {LOCAL}
            new_command_description_header^.command_function_kind := llc$local_to_library;
          IFEND;
        IFEND;

        IF pvt [p$log_option].specified THEN
          IF pvt [p$log_option].value^.keyword_value = 'AUTOMATIC' THEN
            new_command_description_header^.command_log_option := clc$automatically_log;
          ELSE {MANUAL}
            new_command_description_header^.command_log_option := clc$manually_log;
          IFEND;
        IFEND;

        pmp$get_time (osc$hms_time, time, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
        pmp$get_date (osc$mdy_date, date, status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
        new_command_description_header^.time_created := time;
        new_command_description_header^.date_created := date;

        ALLOCATE module_description IN ocv$olg_working_heap^;
        IF module_description = NIL THEN
          osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
          RETURN;
        IFEND;

        module_description^.name := new_command_description_header^.name;
        module_description^.source := occ$current;
        IF new_application_identifier = NIL THEN
          module_description^.kind := occ$command_description;
        ELSE
          module_description^.kind := occ$applic_command_description;
        IFEND;

        size := i#current_sequence_position (ocv$olg_scratch_seq);
        RESET ocv$olg_scratch_seq;

        ALLOCATE module_description^.file: [[REP size OF cell]] IN ocv$olg_working_heap^;
        IF module_description^.file = NIL THEN
          osp$set_status_condition (oce$e_internal_olg_seg_overflow, status);
          RETURN;
        IFEND;

        IF #SEGMENT (nlm^.description^.file) = #SEGMENT (ocv$olg_working_heap) THEN
          FREE nlm^.description^.file IN ocv$olg_working_heap^;
        IFEND;
        nlm^.description := module_description;
        nlm^.description^.file := module_description^.file;

        RESET module_description^.file;

        IF new_application_identifier = NIL THEN
          NEXT module_description^.command_description_header IN module_description^.file;
          NEXT new_command_description_header IN ocv$olg_scratch_seq;
          module_description^.command_description_header^ := new_command_description_header^;
          IF module_description^.command_description_header^.number_of_aliases <> 0 THEN
            NEXT new_alias_list: [1 .. module_description^.command_description_header^.number_of_aliases] IN
                  module_description^.file;
            module_description^.command_description_header^.aliases :=
                  #REL (new_alias_list, module_description^.file^);
            NEXT old_alias_list: [1 .. module_description^.command_description_header^.number_of_aliases] IN
                  ocv$olg_scratch_seq;
            new_alias_list^ := old_alias_list^;
          IFEND;
        ELSE
          NEXT module_description^.applic_command_description_hdr IN module_description^.file;
          NEXT new_applic_command_header IN ocv$olg_scratch_seq;
          module_description^.applic_command_description_hdr^ := new_applic_command_header^;
          IF module_description^.applic_command_description_hdr^.library_member_header.number_of_aliases <>
                0 THEN
            NEXT new_alias_list: [1 .. module_description^.applic_command_description_hdr^.
                  library_member_header.number_of_aliases] IN module_description^.file;
            module_description^.applic_command_description_hdr^.library_member_header.aliases :=
                  #REL (new_alias_list, module_description^.file^);

            NEXT old_alias_list: [1 .. module_description^.applic_command_description_hdr^.
                  library_member_header.number_of_aliases] IN ocv$olg_scratch_seq;
            new_alias_list^ := old_alias_list^;
          IFEND;
        IFEND;

        member_size := size - i#current_sequence_position (module_description^.file);
        NEXT member: [[REP member_size OF cell]] IN module_description^.file;
        IF new_application_identifier = NIL THEN
          module_description^.command_description_header^.member := #REL (member, module_description^.file^);
          module_description^.command_description_header^.member_size := member_size;
        ELSE
          module_description^.applic_command_description_hdr^.library_member_header.member :=
                #REL (member, module_description^.file^);
          module_description^.applic_command_description_hdr^.library_member_header.member_size :=
                member_size;
        IFEND;

        NEXT sequence: [[REP member_size OF cell]] IN ocv$olg_scratch_seq;
        member^ := sequence^;
        name_node := name_node^.link;
      WHILEND;

    END /protect/;
    pmp$disestablish_cond_handler (established_conditions, ignore_status);

  PROCEND ocp$_change_command_description;

MODEND ocm$change_command_description
