?? NEWTITLE := 'NOS/VE Basic Access Method : Attribute Merging Procedure' ??
MODULE bam$merge_open_attributes;
?? RIGHT := 110 ??

{ PURPOSE:
{   This module contains the routine used to merge file attributes.

?? NEWTITLE := 'Global Declarations Referenced by this Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc oss$job_paged_literal
*copyc amc$condition_code_limits
*copyc cld$path_description
*copyc osd$virtual_address
*copyc amt$access_level
*copyc amt$attribute_source
*copyc amt$average_record_length
*copyc amt$block_type
*copyc amt$collate_table
*copyc amt$collation_value
*copyc amt$data_padding
*copyc amt$error_exit_procedure
*copyc amt$error_limit
*copyc amt$estimated_record_count
*copyc amt$file_access_selections
*copyc amt$file_attribute_keys
*copyc amt$file_attributes
*copyc amt$file_byte_address
*copyc amt$file_identifier
*copyc amt$file_length
*copyc amt$file_limit
*copyc amt$file_organization
*copyc amt$file_position
*copyc amt$forced_write
*copyc amt$global_file_position
*copyc amt$index_padding
*copyc amt$internal_code
*copyc amt$key_length
*copyc amt$key_position
*copyc amt$key_type
*copyc amt$label_exit_procedure
*copyc amt$label_options
*copyc amt$label_type
*copyc amt$local_file_name
*copyc amc$mau_length
*copyc amt$max_block_length
*copyc amt$max_record_length
*copyc amt$message_control
*copyc amt$min_block_length
*copyc amt$min_record_length
*copyc amt$padding_character
*copyc amt$record_limit
*copyc amt$record_type
*copyc amt$records_per_block
*copyc amt$return_option
*copyc amt$user_info
*copyc amt$vertical_print_density
*copyc ost$status
*copyc ame$attribute_validation_errors
*copyc amt$access_level
*copyc bat$static_label_attributes
*copyc fst$file_cycle_attributes
*copyc fst$status_reporting_procedure
?? POP ??
*copyc fsp$convert_to_old_contents
*copyc osp$append_status_integer
*copyc osv$lower_to_upper
?? OLDTITLE ??
?? NEWTITLE := 'Global Declarations Declared by this Module', EJECT ??

  VAR
    space: [STATIC, READ, oss$job_paged_literal] packed array [0 .. 255] of
          boolean := [REP 32 of FALSE, TRUE, REP 223 of FALSE],
    underscore: [STATIC, READ, oss$job_paged_literal] packed array [0 .. 255] of
          boolean := [REP 95 of FALSE, TRUE, REP 160 of FALSE];

?? OLDTITLE ??
?? NEWTITLE := '[xdcl] BAP$MERGE_OPEN_ATTRIBUTES', EJECT ??

  PROCEDURE [XDCL] bap$merge_open_attributes
    (    attributes: ^fst$file_cycle_attributes;
         source: amc$open_request .. amc$file_request;
     VAR static_label {input, output} : bat$static_label_attributes;
         status_reporting_procedure_ptr: fst$status_reporting_procedure;
     VAR status: ost$status);

    VAR
      attribute_p: ^fst$file_cycle_attribute,
      i: integer,
      status_text: string (28),
      translated_name: ost$name;

    status.normal := TRUE;
    IF source = amc$file_request THEN
      status_text := 'DEFAULT_CREATION_ATTRIBUTES';
    ELSE
      status_text := 'MANDATED_CREATION_ATTRIBUTES';
    IFEND;

    FOR i := UPPERBOUND (attributes^) DOWNTO 1 DO
      attribute_p := ^attributes^ [i];
      CASE attribute_p^.selector OF
      = fsc$average_record_length =
        IF (static_label.average_record_length_source = amc$undefined_attribute) OR
              (source < static_label.average_record_length_source) THEN
          static_label.average_record_length := attribute_p^.average_record_length;
          static_label.average_record_length_source := amc$open_request;
        IFEND;
      = fsc$block_type =
        IF (static_label.block_type_source = amc$undefined_attribute) OR
              (source < static_label.block_type_source) THEN
          static_label.block_type := attribute_p^.block_type;
          static_label.block_type_source := amc$open_request;
        IFEND;
      = fsc$character_conversion =
        IF (static_label.character_conversion_source = amc$undefined_attribute) OR
              (source < static_label.character_conversion_source) THEN
          static_label.character_conversion := attribute_p^.character_conversion;
          static_label.character_conversion_source := amc$open_request;
        IFEND;
      = fsc$collate_table_name =
        IF (static_label.collate_table_name_source = amc$undefined_attribute) OR
              (source < static_label.collate_table_name_source) THEN
          IF attribute_p^.collate_table_name <> NIL THEN
            #TRANSLATE (osv$lower_to_upper, attribute_p^.collate_table_name^.entry_point, translated_name);
            static_label.collate_table_name := translated_name;
            static_label.collate_table_name_source := amc$open_request;
          IFEND;
        IFEND;
      = fsc$compression_procedure_name =
        IF (static_label.compression_proc_name_source = amc$undefined_attribute) OR
              (source < static_label.compression_proc_name_source) THEN
          IF attribute_p^.compression_procedure_name <> NIL THEN
            #TRANSLATE (osv$lower_to_upper, attribute_p^.compression_procedure_name^.name, translated_name);
            static_label.compression_procedure_name.name := translated_name;
            static_label.compression_procedure_name.object_library :=
                  attribute_p^.compression_procedure_name^.object_library;
            IF static_label.compression_procedure_name.name = osc$null_name THEN
              static_label.compression_proc_name_source := amc$undefined_attribute;
            ELSE
              static_label.compression_proc_name_source := amc$open_request;
            IFEND;
          IFEND;
        IFEND;
      = fsc$data_padding =
        IF (static_label.data_padding_source = amc$undefined_attribute) OR
              (source < static_label.data_padding_source) THEN
          static_label.data_padding := attribute_p^.data_padding;
          static_label.data_padding_source := amc$open_request;
        IFEND;
      = fsc$dynamic_home_block_space =
        IF (static_label.dynamic_home_block_space_source = amc$undefined_attribute) OR
              (source < static_label.dynamic_home_block_space_source) THEN
          static_label.dynamic_home_block_space := attribute_p^.dynamic_home_block_space;
          static_label.dynamic_home_block_space_source := amc$open_request;
        IFEND;
      = fsc$embedded_key =
        IF (static_label.embedded_key_source = amc$undefined_attribute) OR
              (source < static_label.embedded_key_source) THEN
          static_label.embedded_key := attribute_p^.embedded_key;
          static_label.embedded_key_source := amc$open_request;
        IFEND;
      = fsc$erase_at_deletion =
        IF (static_label.clear_space_source = amc$undefined_attribute) OR
              (source < static_label.clear_space_source) THEN
          static_label.clear_space := attribute_p^.erase_at_deletion;
          static_label.clear_space_source := amc$open_request;
        IFEND;
      = fsc$estimated_record_count =
        IF (static_label.estimated_record_count_source = amc$undefined_attribute) OR
              (source < static_label.estimated_record_count_source) THEN
          static_label.estimated_record_count := attribute_p^.estimated_record_count;
          static_label.estimated_record_count_source := amc$open_request;
        IFEND;
      = fsc$file_access_procedure_name =
        IF (static_label.file_access_procedure_source = amc$undefined_attribute) OR
              (source < static_label.file_access_procedure_source) THEN
          IF attribute_p^.file_access_procedure_name <> NIL THEN
            #TRANSLATE (osv$lower_to_upper, attribute_p^.file_access_procedure_name^.entry_point,
                  translated_name);
            static_label.file_access_procedure := translated_name;
            static_label.file_access_procedure_source := amc$open_request;
          IFEND;
        IFEND;
      = fsc$file_contents_and_processor =
        IF ((source < static_label.file_contents_source) OR
              (static_label.file_contents_source = amc$undefined_attribute)) AND
              ((source < static_label.file_structure_source) OR
              (static_label.file_structure_source = amc$undefined_attribute)) THEN
          IF attribute_p^.file_contents <> osc$null_name THEN
            #TRANSLATE (osv$lower_to_upper, attribute_p^.file_contents, translated_name);
            fsp$convert_to_old_contents (translated_name, static_label.file_contents,
                  static_label.file_structure);
            static_label.file_contents_source := amc$open_request;
            static_label.file_structure_source := amc$open_request;
          IFEND;
        IFEND;
        IF (static_label.file_processor_source = amc$undefined_attribute) OR
              (source < static_label.file_processor_source) THEN
          IF attribute_p^.file_processor <> osc$null_name THEN
            #TRANSLATE (osv$lower_to_upper, attribute_p^.file_processor, translated_name);
            static_label.file_processor := translated_name;
            static_label.file_processor_source := amc$open_request;
          IFEND;
        IFEND;
      = fsc$file_label_type =
        IF (static_label.label_type_source = amc$undefined_attribute) OR
              (source < static_label.label_type_source) THEN
          static_label.label_type := attribute_p^.file_label_type;
          static_label.label_type_source := amc$open_request;
        IFEND;
      = fsc$file_limit =
        IF (static_label.file_limit_source = amc$undefined_attribute) OR
              (source < static_label.file_limit_source) THEN
          static_label.file_limit := attribute_p^.file_limit;
          static_label.file_limit_source := amc$open_request;
        IFEND;
      = fsc$file_organization =
        IF (static_label.file_organization_source = amc$undefined_attribute) OR
              (source < static_label.file_organization_source) THEN
          static_label.file_organization := attribute_p^.file_organization;
          static_label.file_organization_source := amc$open_request;
        IFEND;
      = fsc$forced_write =
        IF (static_label.forced_write_source = amc$undefined_attribute) OR
              (source < static_label.forced_write_source) THEN
          static_label.forced_write := attribute_p^.forced_write;
          static_label.forced_write_source := amc$open_request;
        IFEND;
      = fsc$hashing_procedure_name =
        IF (static_label.hashing_procedure_name_source = amc$undefined_attribute) OR
              (source < static_label.hashing_procedure_name_source) THEN
          IF attribute_p^.hashing_procedure_name <> NIL THEN
            #TRANSLATE (osv$lower_to_upper, attribute_p^.hashing_procedure_name^.name, translated_name);
            static_label.hashing_procedure_name.name := translated_name;
            static_label.hashing_procedure_name.object_library :=
                  attribute_p^.hashing_procedure_name^.object_library;
            IF static_label.hashing_procedure_name.name = osc$null_name THEN
              static_label.hashing_procedure_name_source := amc$undefined_attribute;
            ELSE
              static_label.hashing_procedure_name_source := amc$open_request;
            IFEND;
          IFEND;
        IFEND;
      = fsc$index_levels =
        IF (static_label.index_levels_source = amc$undefined_attribute) OR
              (source < static_label.index_levels_source) THEN
          static_label.index_levels := attribute_p^.index_levels;
          static_label.index_levels_source := amc$open_request;
        IFEND;
      = fsc$index_padding =
        IF (static_label.index_padding_source = amc$undefined_attribute) OR
              (source < static_label.index_padding_source) THEN
          static_label.index_padding := attribute_p^.index_padding;
          static_label.index_padding_source := amc$open_request;
        IFEND;
      = fsc$initial_home_block_count =
        IF (static_label.initial_home_block_count_source = amc$undefined_attribute) OR
              (source < static_label.initial_home_block_count_source) THEN
          static_label.initial_home_block_count := attribute_p^.initial_home_block_count;
          static_label.initial_home_block_count_source := amc$open_request;
        IFEND;
      = fsc$internal_code =
        IF (static_label.internal_code_source = amc$undefined_attribute) OR
              (source < static_label.internal_code_source) THEN
          static_label.internal_code := attribute_p^.internal_code;
          static_label.internal_code_source := amc$open_request;
        IFEND;
      = fsc$key_length =
        IF (static_label.key_length_source = amc$undefined_attribute) OR
              (source < static_label.key_length_source) THEN
          static_label.key_length := attribute_p^.key_length;
          static_label.key_length_source := amc$open_request;
        IFEND;
      = fsc$key_position =
        IF (static_label.key_position_source = amc$undefined_attribute) OR
              (source < static_label.key_position_source) THEN
          static_label.key_position := attribute_p^.key_position;
          static_label.key_position_source := amc$open_request;
        IFEND;
      = fsc$key_type =
        IF (static_label.key_type_source = amc$undefined_attribute) OR
              (source < static_label.key_type_source) THEN
          static_label.key_type := attribute_p^.key_type;
          static_label.key_type_source := amc$open_request;
        IFEND;
      = fsc$line_number =
        IF (static_label.line_number_source = amc$undefined_attribute) OR
              (source < static_label.line_number_source) THEN
          static_label.line_number := attribute_p^.line_number;
          static_label.line_number_source := amc$open_request;
        IFEND;
      = fsc$loading_factor =
        IF (static_label.loading_factor_source = amc$undefined_attribute) OR
              (source < static_label.loading_factor_source) THEN
          static_label.loading_factor := attribute_p^.loading_factor;
          static_label.loading_factor_source := amc$open_request;
        IFEND;
      = fsc$lock_expiration_time =
        IF (static_label.lock_expiration_time_source = amc$undefined_attribute) OR
              (source < static_label.lock_expiration_time_source) THEN
          static_label.lock_expiration_time := attribute_p^.lock_expiration_time;
          static_label.lock_expiration_time_source := amc$open_request;
        IFEND;
      = fsc$log_residence =
        IF (static_label.log_residence_source = amc$undefined_attribute) OR
              (source < static_label.log_residence_source) THEN
          IF attribute_p^.log_residence <> NIL THEN
            static_label.log_residence := attribute_p^.log_residence^;
            IF static_label.log_residence = osc$null_name THEN
              static_label.log_residence_source := amc$undefined_attribute;
            ELSE
              static_label.log_residence_source := amc$open_request;
            IFEND;
          IFEND;
        IFEND;
      = fsc$logging_options =
        IF (static_label.logging_options_source = amc$undefined_attribute) OR
              (source < static_label.logging_options_source) THEN
          static_label.logging_options := attribute_p^.logging_options;
          static_label.logging_options_source := amc$open_request;
        IFEND;
      = fsc$max_block_length =
        IF (static_label.max_block_length_source = amc$undefined_attribute) OR
              (source < static_label.max_block_length_source) THEN
          static_label.max_block_length := attribute_p^.max_block_length;
          static_label.max_block_length_source := amc$open_request;
        IFEND;
      = fsc$max_record_length =
        IF (static_label.max_record_length_source = amc$undefined_attribute) OR
              (source < static_label.max_record_length_source) THEN
          static_label.max_record_length := attribute_p^.max_record_length;
          static_label.max_record_length_source := amc$open_request;
        IFEND;
      = fsc$min_block_length =
        IF (static_label.min_block_length_source = amc$undefined_attribute) OR
              (source < static_label.min_block_length_source) THEN
          static_label.min_block_length := attribute_p^.min_block_length;
          static_label.min_block_length_source := amc$open_request;
        IFEND;
      = fsc$min_record_length =
        IF (static_label.min_record_length_source = amc$undefined_attribute) OR
              (source < static_label.min_record_length_source) THEN
          static_label.min_record_length := attribute_p^.min_record_length;
          static_label.min_record_length_source := amc$open_request;
        IFEND;
      = fsc$null_attribute =
        ;
      = fsc$padding_character =
        IF (static_label.padding_character_source = amc$undefined_attribute) OR
              (source < static_label.padding_character_source) THEN
          static_label.padding_character := attribute_p^.padding_character;
          static_label.padding_character_source := amc$open_request;
        IFEND;
      = fsc$page_format =
        IF (static_label.page_format_source = amc$undefined_attribute) OR
              (source < static_label.page_format_source) THEN
          static_label.page_format := attribute_p^.page_format;
          static_label.page_format_source := amc$open_request;
        IFEND;
      = fsc$page_length =
        IF (static_label.page_length_source = amc$undefined_attribute) OR
              (source < static_label.page_length_source) THEN
          static_label.page_length := attribute_p^.page_length;
          static_label.page_length_source := amc$open_request;
        IFEND;
      = fsc$page_width =
        IF (static_label.page_width_source = amc$undefined_attribute) OR
              (source < static_label.page_width_source) THEN
          static_label.page_width := attribute_p^.page_width;
          static_label.page_width_source := amc$open_request;
        IFEND;
      = fsc$preset_value =
        IF (static_label.preset_value_source = amc$undefined_attribute) OR
              (source < static_label.preset_value_source) THEN
          static_label.preset_value := attribute_p^.preset_value;
          static_label.preset_value_source := amc$open_request;
        IFEND;
      = fsc$record_delimiting_character =
        IF (static_label.record_delimiting_char_source = amc$undefined_attribute) OR
              (source < static_label.record_delimiting_char_source) THEN
          static_label.record_delimiting_character := attribute_p^.record_delimiting_character;
          static_label.record_delimiting_char_source := amc$open_request;
        IFEND;
      = fsc$record_limit =
        IF (static_label.record_limit_source = amc$undefined_attribute) OR
              (source < static_label.record_limit_source) THEN
          static_label.record_limit := attribute_p^.record_limit;
          static_label.record_limit_source := amc$open_request;
        IFEND;
      = fsc$record_type =
        IF (static_label.record_type_source = amc$undefined_attribute) OR
              (source < static_label.record_type_source) THEN
          static_label.record_type := attribute_p^.record_type;
          static_label.record_type_source := amc$open_request;
        IFEND;
      = fsc$records_per_block =
        IF (static_label.records_per_block_source = amc$undefined_attribute) OR
              (source < static_label.records_per_block_source) THEN
          static_label.records_per_block := attribute_p^.records_per_block;
          static_label.records_per_block_source := amc$open_request;
        IFEND;
      = fsc$retention =
        ;
      = fsc$retrieve_option =
        ;
      = fsc$ring_attributes =
        IF (static_label.ring_attributes_source = amc$undefined_attribute) OR
              (source < static_label.ring_attributes_source) THEN
          static_label.ring_attributes := attribute_p^.ring_attributes;
          static_label.ring_attributes_source := amc$open_request;
        IFEND;
      = fsc$site_archive_option =
        ;
      = fsc$site_backup_option =
        ;
      = fsc$site_release_option =
        ;
      = fsc$statement_identifier =
        IF (static_label.statement_identifier_source = amc$undefined_attribute) OR
              (source < static_label.statement_identifier_source) THEN
          static_label.statement_identifier := attribute_p^.statement_identifier;
          static_label.statement_identifier_source := amc$open_request;
        IFEND;
      = fsc$user_attribute =
        ;
      = fsc$user_information =
        IF (static_label.user_info_source = amc$undefined_attribute) OR
              (source < static_label.user_info_source) THEN
          static_label.user_info := attribute_p^.user_information;
          static_label.user_info_source := amc$open_request;
        IFEND;
      = fsc$vertical_print_density =
        IF (static_label.vertical_print_density_source = amc$undefined_attribute) OR
              (source < static_label.vertical_print_density_source) THEN
          static_label.vertical_print_density := attribute_p^.vertical_print_density;
          static_label.vertical_print_density_source := amc$open_request;
        IFEND;

      ELSE
        IF status.normal THEN
          status_reporting_procedure_ptr^ (ame$improper_file_attrib_key, status_text, status);
          osp$append_status_integer (osc$status_parameter_delimiter, i, 10, false, status);
        ELSE
          osp$append_status_integer (',', i, 10, false, status);
        IFEND;
      CASEND;
    FOREND;

  PROCEND bap$merge_open_attributes;
?? OLDTITLE ??
MODEND bam$merge_open_attributes;
