?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE SCL Interpreter : Command List Manipulation Commands' ??
MODULE clm$set_command_list;

{
{ PURPOSE:
{   This module contains the processors for the follwoing commands:
{
{               change_command_search_mode
{               change_system_command_library     advanced
{               create_command_list_entry
{               delete_command_list_entry
{               set_command_list                  hidden
{

?? NEWTITLE := 'Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc cle$all_must_be_used_alone
*copyc cle$ecc_command_processing
*copyc cle$ecc_parameter_list
*copyc cle$ecc_utilities
*copyc clt$command_list
*copyc oss$job_paged_literal
*copyc oss$task_shared
*copyc ost$caller_identifier
*copyc ost$name_reference
*copyc ost$status
?? POP ??
*copyc clp$evaluate_parameters
*copyc clp$add_file_to_command_list
*copyc clp$delete_all_from_cmnd_list
*copyc clp$delete_file_from_cmnd_list
*copyc clp$establish_sys_command_lib
*copyc clp$reverse_list
*copyc clp$set_job_command_search_mode
*copyc osp$set_status_abnormal
*copyc osp$append_status_parameter
*copyc osp$generate_output_message
*copyc osp$enforce_exception_policies
*copyc osp$file_access_condition
*copyc osv$initial_exception_context
?? TITLE := 'clp$_set_command_list', EJECT ??

  PROCEDURE [XDCL] clp$_set_command_list
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (HIDDEN, osm$setcl) set_command_list, setcl (
{   delete, d: any of
{       key
{         all
{       keyend
{       list of any of
{         key
{           $system
{         advanced_key
{           fence
{         keyend
{         file
{       anyend
{     anyend = $optional
{   add, a: list of any of
{       key
{         $system
{       advanced_key
{         fence
{       keyend
{       file
{     anyend = $optional
{   search_mode, sm: key
{       (global, g)
{       (restricted, r)
{       (exclusive, e)
{     keyend = $optional
{   placement, p: key
{       (after, a)
{       (before, b)
{     keyend = before
{   system_command_library, scl: any of
{       key
{         (standard, s)
{       hidden_key
{         none
{       keyend
{       file
{     anyend = $optional
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 11] of clt$pdt_parameter_name,
      parameters: array [1 .. 6] of clt$pdt_parameter,
      type1: 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$list_type_qualifier,
          element_type_spec: 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,
          recend,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier,
        element_type_spec: 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,
        recend,
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 6] of clt$keyword_specification,
      recend,
      type4: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
        default_value: string (6),
      recend,
      type5: 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 .. 3] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
        recend,
      recend,
      type6: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [90, 1, 30, 14, 43, 56, 772],
    clc$command, 11, 6, 0, 0, 0, 0, 6, 'OSM$SETCL'], [
    ['A                              ',clc$abbreviation_entry, 2],
    ['ADD                            ',clc$nominal_entry, 2],
    ['D                              ',clc$abbreviation_entry, 1],
    ['DELETE                         ',clc$nominal_entry, 1],
    ['P                              ',clc$abbreviation_entry, 4],
    ['PLACEMENT                      ',clc$nominal_entry, 4],
    ['SCL                            ',clc$abbreviation_entry, 5],
    ['SEARCH_MODE                    ',clc$nominal_entry, 3],
    ['SM                             ',clc$abbreviation_entry, 3],
    ['STATUS                         ',clc$nominal_entry, 6],
    ['SYSTEM_COMMAND_LIBRARY         ',clc$nominal_entry, 5]],
    [
{ PARAMETER 1
    [4, 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, 184,
  clc$optional_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, 120,
  clc$optional_parameter, 0, 0],
{ PARAMETER 3
    [8, 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, 229,
  clc$optional_parameter, 0, 0],
{ PARAMETER 4
    [6, 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, 155,
  clc$optional_default_parameter, 0, 6],
{ PARAMETER 5
    [11, 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, 141,
  clc$optional_parameter, 0, 0],
{ PARAMETER 6
    [10, 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$union_type], [[clc$keyword_type, clc$list_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    120, [[1, 0, clc$list_type], [104, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$union_type], [[clc$file_type, clc$keyword_type],
        FALSE, 2],
        81, [[1, 0, clc$keyword_type], [2], [
          ['$SYSTEM                        ', clc$nominal_entry, clc$normal_usage_entry, 1],
          ['FENCE                          ', clc$nominal_entry, clc$advanced_usage_entry, 2]]
          ],
        3, [[1, 0, clc$file_type]]
        ]
      ]
    ],
{ PARAMETER 2
    [[1, 0, clc$list_type], [104, 1, clc$max_list_size, FALSE],
      [[1, 0, clc$union_type], [[clc$file_type, clc$keyword_type],
      FALSE, 2],
      81, [[1, 0, clc$keyword_type], [2], [
        ['$SYSTEM                        ', clc$nominal_entry, clc$normal_usage_entry, 1],
        ['FENCE                          ', clc$nominal_entry, clc$advanced_usage_entry, 2]]
        ],
      3, [[1, 0, clc$file_type]]
      ]
    ],
{ PARAMETER 3
    [[1, 0, clc$keyword_type], [6], [
    ['E                              ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
    ['EXCLUSIVE                      ', clc$nominal_entry, clc$normal_usage_entry, 3],
    ['G                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['GLOBAL                         ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['R                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['RESTRICTED                     ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ],
{ PARAMETER 4
    [[1, 0, clc$keyword_type], [4], [
    ['A                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['AFTER                          ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['B                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['BEFORE                         ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ,
    'before'],
{ PARAMETER 5
    [[1, 0, clc$union_type], [[clc$file_type, clc$keyword_type],
    FALSE, 2],
    118, [[1, 0, clc$keyword_type], [3], [
      ['NONE                           ', clc$nominal_entry, clc$hidden_entry, 2],
      ['S                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
      ['STANDARD                       ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    3, [[1, 0, clc$file_type]]
    ],
{ PARAMETER 6
    [[1, 0, clc$status_type]]];

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

    CONST
      p$delete = 1,
      p$add = 2,
      p$search_mode = 3,
      p$placement = 4,
      p$system_command_library = 5,
      p$status = 6;

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


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

    IF pvt [p$delete].specified THEN
      delete_command_list_entry (pvt [p$delete].value, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;

    IF pvt [p$add].specified THEN
      create_command_list_entry (pvt [p$add].value, pvt [p$placement].value^.keyword_value (1), status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;

    IF pvt [p$system_command_library].specified THEN
      change_system_command_library (pvt [p$system_command_library].value, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;

    IF pvt [p$search_mode].specified THEN
      change_search_mode (pvt [p$search_mode].value^.keyword_value, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;

  PROCEND clp$_set_command_list;
?? TITLE := 'clp$_delete_command_list_entry', EJECT ??

  PROCEDURE [XDCL] clp$_delete_command_list_entry
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$delcle) delete_command_list_entry, delete_command_list_entries, delcle (
{   entry, entries, e: any of
{       key
{         all
{       keyend
{       list of any of
{         key
{           $system
{         advanced_key
{           fence
{         keyend
{         file
{       anyend
{     anyend = $required
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 4] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: 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$list_type_qualifier,
          element_type_spec: 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,
          recend,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [90, 1, 30, 14, 10, 55, 404],
    clc$command, 4, 2, 1, 0, 0, 0, 2, 'OSM$DELCLE'], [
    ['E                              ',clc$abbreviation_entry, 1],
    ['ENTRIES                        ',clc$alias_entry, 1],
    ['ENTRY                          ',clc$nominal_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 2]],
    [
{ 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, 184,
  clc$required_parameter, 0, 0],
{ PARAMETER 2
    [4, 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$union_type], [[clc$keyword_type, clc$list_type],
    FALSE, 2],
    44, [[1, 0, clc$keyword_type], [1], [
      ['ALL                            ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    120, [[1, 0, clc$list_type], [104, 1, clc$max_list_size, FALSE],
        [[1, 0, clc$union_type], [[clc$file_type, clc$keyword_type],
        FALSE, 2],
        81, [[1, 0, clc$keyword_type], [2], [
          ['$SYSTEM                        ', clc$nominal_entry, clc$normal_usage_entry, 1],
          ['FENCE                          ', clc$nominal_entry, clc$advanced_usage_entry, 2]]
          ],
        3, [[1, 0, clc$file_type]]
        ]
      ]
    ],
{ PARAMETER 2
    [[1, 0, clc$status_type]]];

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

    CONST
      p$entry = 1,
      p$status = 2;

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


    status.normal := TRUE;

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

    delete_command_list_entry (pvt [p$entry].value, status);

  PROCEND clp$_delete_command_list_entry;
?? TITLE := 'clp$_create_command_list_entry', EJECT ??

  PROCEDURE [XDCL] clp$_create_command_list_entry
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$crecle) create_command_list_entry, create_command_list_entries, crecle (
{   entry, entries, e: list of any of
{       key
{         $system
{       advanced_key
{         fence
{       keyend
{       file
{     anyend = $required
{   placement, p: key
{       (after, a)
{       (before, b)
{     keyend = before
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 6] of clt$pdt_parameter_name,
      parameters: array [1 .. 3] 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$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,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
        default_value: string (6),
      recend,
      type3: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [90, 1, 30, 14, 16, 27, 671],
    clc$command, 6, 3, 1, 0, 0, 0, 3, 'OSM$CRECLE'], [
    ['E                              ',clc$abbreviation_entry, 1],
    ['ENTRIES                        ',clc$alias_entry, 1],
    ['ENTRY                          ',clc$nominal_entry, 1],
    ['P                              ',clc$abbreviation_entry, 2],
    ['PLACEMENT                      ',clc$nominal_entry, 2],
    ['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, 120,
  clc$required_parameter, 0, 0],
{ PARAMETER 2
    [5, 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, 155,
  clc$optional_default_parameter, 0, 6],
{ PARAMETER 3
    [6, 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], [104, 1, clc$max_list_size, FALSE],
      [[1, 0, clc$union_type], [[clc$file_type, clc$keyword_type],
      FALSE, 2],
      81, [[1, 0, clc$keyword_type], [2], [
        ['$SYSTEM                        ', clc$nominal_entry, clc$normal_usage_entry, 1],
        ['FENCE                          ', clc$nominal_entry, clc$advanced_usage_entry, 2]]
        ],
      3, [[1, 0, clc$file_type]]
      ]
    ],
{ PARAMETER 2
    [[1, 0, clc$keyword_type], [4], [
    ['A                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['AFTER                          ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['B                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['BEFORE                         ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ,
    'before'],
{ PARAMETER 3
    [[1, 0, clc$status_type]]];

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

    CONST
      p$entry = 1,
      p$placement = 2,
      p$status = 3;

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


    status.normal := TRUE;

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

    create_command_list_entry (pvt [p$entry].value, pvt [p$placement].value^.keyword_value (1), status);

  PROCEND clp$_create_command_list_entry;
?? TITLE := 'clp$_change_command_search_mode', EJECT ??

  PROCEDURE [XDCL] clp$_change_command_search_mode
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$chacsm) change_command_search_mode, chacsm (
{   search_mode, sm: key
{       (global, g)
{       (restricted, r)
{       (exclusive, e)
{     keyend = $required
{   status)

?? PUSH (LISTEXT := ON) ??

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 3] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 6] of clt$keyword_specification,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [88, 6, 13, 15, 12, 12, 494],
    clc$command, 3, 2, 1, 0, 0, 0, 2, 'OSM$CHACSM'], [
    ['SEARCH_MODE                    ',clc$nominal_entry, 1],
    ['SM                             ',clc$abbreviation_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [1, 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, 229,
  clc$required_parameter, 0, 0],
{ PARAMETER 2
    [3, 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$keyword_type], [6], [
    ['E                              ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
    ['EXCLUSIVE                      ', clc$nominal_entry, clc$normal_usage_entry, 3],
    ['G                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['GLOBAL                         ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['R                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['RESTRICTED                     ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ],
{ PARAMETER 2
    [[1, 0, clc$status_type]]];

?? POP ??

  CONST
    p$search_mode = 1,
    p$status = 2;

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


    status.normal := TRUE;

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

    change_search_mode (pvt [p$search_mode].value^.keyword_value, status);

  PROCEND clp$_change_command_search_mode;
?? TITLE := 'clp$_change_system_command_libr', EJECT ??

  PROCEDURE [XDCL] clp$_change_system_command_libr
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (ADVANCED, osm$chascl) change_system_command_library, chascl (
{   system_command_library, scl: any of
{       key
{         (standard, s)
{       hidden_key
{         none
{       keyend
{       file
{     anyend = $required
{   status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 3] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: 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 .. 3] of clt$keyword_specification,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [90, 1, 30, 14, 29, 26, 472],
    clc$command, 3, 2, 1, 0, 0, 0, 2, 'OSM$CHASCL'], [
    ['SCL                            ',clc$abbreviation_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 2],
    ['SYSTEM_COMMAND_LIBRARY         ',clc$nominal_entry, 1]],
    [
{ 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, 141,
  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$pass_by_reference, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$union_type], [[clc$file_type, clc$keyword_type],
    FALSE, 2],
    118, [[1, 0, clc$keyword_type], [3], [
      ['NONE                           ', clc$nominal_entry, clc$hidden_entry, 2],
      ['S                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
      ['STANDARD                       ', clc$nominal_entry, clc$normal_usage_entry, 1]]
      ],
    3, [[1, 0, clc$file_type]]
    ],
{ PARAMETER 2
    [[1, 0, clc$status_type]]];

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

    CONST
      p$system_command_library = 1,
      p$status = 2;

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


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

    change_system_command_library (pvt [p$system_command_library].value, status);

  PROCEND clp$_change_system_command_libr;
?? TITLE := 'delete_command_list_entry', EJECT ??

  PROCEDURE delete_command_list_entry
    (    delete_list: ^clt$data_value;
     VAR status: ost$status);

    VAR
      context: ^ost$ecp_exception_context,
      found_error: boolean,
      file: clt$command_list_entry_file,
      ignore_status: ost$status,
      local_status: ost$status,
      node: ^clt$data_value;

    PUSH context;
    found_error := FALSE;
    IF delete_list^.kind = clc$keyword {ALL} THEN
      REPEAT
        clp$delete_all_from_cmnd_list (status);
        IF NOT status.normal THEN
          context^ := osv$initial_exception_context;
          context^.condition_status := status;
          osp$enforce_exception_policies (context^);
          status := context^.condition_status;
        IFEND;
      UNTIL status.normal OR (NOT osp$file_access_condition (status)) OR (NOT context^.wait);
      RETURN;
    IFEND;

    node := delete_list;
    WHILE node <> NIL DO
      IF node^.element_value^.kind = clc$file THEN
        file.kind := clc$command_list_entry_path;
        file.path := node^.element_value^.file_value;
      ELSEIF node^.element_value^.keyword_value = '$SYSTEM' THEN
        file.kind := clc$command_list_entry_$system;
      ELSE {FENCE}
        file.kind := clc$command_list_entry_fence;
      IFEND;

      REPEAT
        clp$delete_file_from_cmnd_list (file, local_status);
        IF NOT local_status.normal THEN
          context^ := osv$initial_exception_context;
          IF file.kind = clc$command_list_entry_path THEN
            context^.file.selector := osc$ecp_file_reference;
            context^.file.file_reference := file.path;
          IFEND;
          context^.condition_status := local_status;
          osp$enforce_exception_policies (context^);
          local_status := context^.condition_status;
        IFEND;
      UNTIL local_status.normal OR (NOT osp$file_access_condition (local_status)) OR (NOT context^.wait);
      IF (NOT local_status.normal) THEN
        IF ((local_status.condition = cle$entry_not_in_command_list) OR
             (local_status.condition = cle$not_in_command_list)) THEN
          IF (NOT found_error) THEN
            found_error := TRUE;
            status := local_status;
          ELSE
            IF node^.element_value^.keyword_value = '$SYSTEM' THEN
              osp$append_status_parameter (',', '$SYSTEM', status);
            ELSE
              osp$append_status_parameter (',', file.path^, status);
            IFEND;
          IFEND;
        ELSE
          IF found_error THEN
            osp$generate_output_message(status,ignore_status);
          IFEND;
          status := local_status;
          RETURN;
        IFEND;
      IFEND;
      node := node^.link;
    WHILEND;

  PROCEND delete_command_list_entry;
?? TITLE := 'create_command_list_entry', EJECT ??

  PROCEDURE create_command_list_entry
    (   add_list: ^clt$data_value;
        placement: char;
     VAR status: ost$status);

    VAR
      append: boolean,
      context: ^ost$ecp_exception_context,
      file: clt$command_list_entry_file,
      node: ^clt$data_value;

    PUSH context;
    node := add_list;
    append := placement = 'A';

    IF NOT append THEN
      clp$reverse_list (node);
    IFEND;

    WHILE node <> NIL DO
      IF node^.element_value^.kind = clc$file THEN
        file.kind := clc$command_list_entry_path;
        file.path := node^.element_value^.file_value;
      ELSEIF node^.element_value^.keyword_value = '$SYSTEM' THEN
        file.kind := clc$command_list_entry_$system;
      ELSE
        file.kind := clc$command_list_entry_fence;
      IFEND;

      REPEAT
        clp$add_file_to_command_list (file, append, status);
        IF NOT status.normal THEN
          context^ := osv$initial_exception_context;
          IF file.kind = clc$command_list_entry_path THEN
            context^.file.selector := osc$ecp_file_reference;
            context^.file.file_reference := file.path;
          IFEND;
          context^.condition_status := status;
          osp$enforce_exception_policies (context^);
          status := context^.condition_status;
        IFEND;
      UNTIL status.normal OR (NOT osp$file_access_condition (status)) OR (NOT context^.wait);
      IF NOT status.normal THEN
        RETURN;
      IFEND;

      node := node^.link;
    WHILEND

  PROCEND create_command_list_entry;
?? TITLE := 'change_search_mode', EJECT ??

  PROCEDURE [INLINE] change_search_mode
    (    search_mode_keyword: clt$keyword;
     VAR status: ost$status);

    VAR
      search_mode: clt$command_search_modes;


    IF search_mode_keyword = 'EXCLUSIVE' THEN
      search_mode := clc$exclusive_command_search;
    ELSEIF search_mode_keyword = 'RESTRICTED' THEN
      search_mode := clc$restricted_command_search;
    ELSE {GLOBAL}
      search_mode := clc$global_command_search;
    IFEND;

    clp$set_job_command_search_mode (search_mode, status);

  PROCEND change_search_mode;
?? TITLE := 'change_system_command_library', EJECT ??

  PROCEDURE change_system_command_library
    (    system_command_library: ^clt$data_value;
     VAR status: ost$status);

    CONST
      standard_system_command_library = ':$SYSTEM.$SYSTEM.OSF$COMMAND_LIBRARY';

    VAR
      context: ^ost$ecp_exception_context,
      file: ^fst$file_reference;


    status.normal := TRUE;
    PUSH context;
    IF system_command_library^.kind = clc$file THEN
      file := system_command_library^.file_value;
    ELSEIF system_command_library^.keyword_value = 'STANDARD' THEN
      PUSH file: [STRLENGTH (standard_system_command_library)];
      file^ := standard_system_command_library;
    ELSE {NONE}
      file := NIL;
    IFEND;

    REPEAT
      clp$establish_sys_command_lib (file, status);
      IF NOT status.normal THEN
        context^ := osv$initial_exception_context;
        IF system_command_library^.kind = clc$file THEN
          context^.file.selector := osc$ecp_file_reference;
          context^.file.file_reference := file;
        IFEND;
        context^.condition_status := status;
        osp$enforce_exception_policies (context^);
        status := context^.condition_status;
      IFEND;
    UNTIL status.normal OR (NOT osp$file_access_condition (status)) OR (NOT context^.wait);

  PROCEND change_system_command_library;

MODEND clm$set_command_list;
