*copyc osd$default_pragmats
MODULE fmm$file_label_functions;

*copyc fmh$file_label_functions
?? NEWTITLE := 'Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc ame$attribute_validation_errors
*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$lfn_program_actions
*copyc amt$file_reference
*copyc bat$static_label_attributes
*copyc fmc$unique_label_id
*copyc fmt$cycle_description
*copyc fmt$file_attribute_keys
*copyc fmt$static_label_header
*copyc fmt$static_label_item
*copyc fmt$system_file_label
*copyc ose$heap_full_exceptions
*copyc oss$job_paged_literal
*copyc ost$status
?? POP ??
*copyc i#current_sequence_position
*copyc i#move
*copyc fsp$expand_file_label
*copyc osp$set_status_abnormal

*copyc fmv$default_file_attributes
*copyc fmv$static_label_header
*copyc fmv$system_file_attributes
*copyc osv$job_pageable_heap

  TYPE
    fmt$file_source = set of amt$attribute_source;

  VAR
    space_selector: [STATIC, READ, oss$job_paged_literal] packed array
      [0 .. 255] of boolean := [REP 32 of FALSE, TRUE, REP 223 of FALSE],
    unspecified_sources: [STATIC, READ, oss$job_paged_literal] fmt$file_source := $fmt$file_source
      [amc$undefined_attribute, amc$access_method_default];


?? TITLE := '[XDCL] fmp$put_label_attributes', EJECT ??

  PROCEDURE [XDCL, #GATE] fmp$put_label_attributes (static_label_attributes:
    bat$static_label_attributes;
    VAR system_file_label: fmt$system_file_label);

    VAR
      i: integer,
      seq_size,
      static_label_size: integer,
      stack_seq: ^SEQ ( * ),
      header: ^fmt$static_label_header,
      p_cell: ^cell,
      p_specified_string: ^string (64000),
      p_default_string: ^string (64000),
      default_file_attributes: bat$static_label_attributes,
      attribute_key: fmt$file_attribute_keys,
      static_label_item: ^fmt$static_label_item,
      name_index: 1 .. 32,
      path_index: 1 .. 257,
      ignore_found: boolean,
      str: ^string ( * );

    PROCEDURE [INLINE] put_entry_point_reference (name: pmt$program_name;
          path: amt$file_reference);

      #SCAN (space_selector, name, name_index, ignore_found);
      static_label_item^.entry_point_name_length := name_index - 1;
      #SCAN (space_selector, path, path_index, ignore_found);
      static_label_item^.entry_point_path_length := path_index - 1;
      NEXT str: [static_label_item^.entry_point_name_length] IN stack_seq;
      str^ (1, static_label_item^.entry_point_name_length) := name;
      IF path_index > 1 THEN
        NEXT str: [static_label_item^.entry_point_path_length] IN stack_seq;
        str^ (1, static_label_item^.entry_point_path_length) := path;
      IFEND;
    PROCEND put_entry_point_reference;

    PROCEDURE [INLINE] put_name (name: pmt$program_name);

      #SCAN (space_selector, name, name_index, ignore_found);
      static_label_item^.name_length := name_index - 1;
      NEXT str: [static_label_item^.name_length] IN stack_seq;
      str^ (1, static_label_item^.name_length) := name;
    PROCEND put_name;

    p_cell := ^static_label_attributes;
    p_specified_string := p_cell;
    IF fmv$default_file_attributes = NIL THEN
      p_cell := ^fmv$system_file_attributes.static_label;
    ELSE
      p_cell := fmv$default_file_attributes;
    IFEND;
    p_default_string := p_cell;
    IF p_specified_string^ (1, #SIZE (bat$static_label_attributes)) <>
          p_default_string^ (1, #SIZE (bat$static_label_attributes)) THEN
      seq_size := (#SIZE(amt$entry_point_reference) * fmc$highest_current_attribute)
            + #SIZE(fmt$static_label_header);
      PUSH stack_seq: [[REP seq_size OF cell]];
      RESET stack_seq;
      NEXT header IN stack_seq;
      header^ := fmv$static_label_header;
      IF fmv$default_file_attributes = NIL THEN
        default_file_attributes := fmv$system_file_attributes.static_label;
      ELSE
        default_file_attributes := fmv$default_file_attributes^;
      IFEND;
      FOR attribute_key := LOWERBOUND (header^. attribute_present) TO
          fmc$highest_current_attribute DO
        CASE attribute_key OF
        = fmc$block_type =
          IF NOT(static_label_attributes.block_type_source IN
                unspecified_sources) OR (static_label_attributes.block_type <>
                default_file_attributes.block_type) THEN
            header^.attribute_present [fmc$block_type] := TRUE;
            header^.highest_attribute_present := fmc$block_type;
            NEXT static_label_item: [fmc$block_type] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  block_type_source;
            static_label_item^.block_type := static_label_attributes.
                  block_type;
          IFEND;
        = fmc$character_conversion =
          IF NOT(static_label_attributes.character_conversion_source IN
                unspecified_sources) OR (static_label_attributes.character_conversion <>
                default_file_attributes.character_conversion) THEN
            header^.attribute_present [fmc$character_conversion] := TRUE;
            header^.highest_attribute_present := fmc$character_conversion;
            NEXT static_label_item: [fmc$character_conversion] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  character_conversion_source;
            static_label_item^.character_conversion := static_label_attributes.
                  character_conversion;
          IFEND;
        = fmc$clear_space =
          IF NOT(static_label_attributes.clear_space_source IN
                unspecified_sources) OR (static_label_attributes.clear_space <>
                default_file_attributes.clear_space) THEN
            header^.attribute_present [fmc$clear_space] := TRUE;
            header^.highest_attribute_present := fmc$clear_space;
            NEXT static_label_item: [fmc$clear_space] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  clear_space_source;
            static_label_item^.clear_space := static_label_attributes.
                  clear_space;
          IFEND;
        = fmc$file_access_procedure =
          IF NOT(static_label_attributes.file_access_procedure_source IN
                unspecified_sources) OR (static_label_attributes.file_access_procedure <>
                default_file_attributes.file_access_procedure) THEN
            header^.attribute_present [fmc$file_access_procedure] := TRUE;
            header^.highest_attribute_present := fmc$file_access_procedure;
            NEXT static_label_item: [fmc$file_access_procedure] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  file_access_procedure_source;
            put_entry_point_reference (static_label_attributes.
                  file_access_procedure, osc$null_name);
          IFEND;
        = fmc$file_contents =
          IF NOT(static_label_attributes.file_contents_source IN
                unspecified_sources) OR (static_label_attributes.file_contents <>
                default_file_attributes.file_contents) THEN
            header^.attribute_present [fmc$file_contents] := TRUE;
            header^.highest_attribute_present := fmc$file_contents;
            NEXT static_label_item: [fmc$file_contents] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  file_contents_source;
            put_name (static_label_attributes.file_contents);
          IFEND;
        = fmc$file_limit =
          IF NOT(static_label_attributes.file_limit_source IN
                unspecified_sources) OR (static_label_attributes.file_limit <>
                default_file_attributes.file_limit) THEN
            header^.attribute_present [fmc$file_limit] := TRUE;
            header^.highest_attribute_present := fmc$file_limit;
            NEXT static_label_item: [fmc$file_limit] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  file_limit_source;
            static_label_item^.integer_value := static_label_attributes.
                  file_limit;
          IFEND;
        = fmc$file_organization =
          IF NOT(static_label_attributes.file_organization_source IN
                unspecified_sources) OR (static_label_attributes.file_organization <>
                default_file_attributes.file_organization) THEN
            header^.attribute_present [fmc$file_organization] := TRUE;
            header^.highest_attribute_present := fmc$file_organization;
            NEXT static_label_item: [fmc$file_organization] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  file_organization_source;
            static_label_item^.file_organization := static_label_attributes.
                  file_organization;
          IFEND;
        = fmc$file_processor =
          IF NOT(static_label_attributes.file_processor_source IN
                unspecified_sources) OR (static_label_attributes.file_processor <>
                default_file_attributes.file_processor) THEN
            header^.attribute_present [fmc$file_processor] := TRUE;
            header^.highest_attribute_present := fmc$file_processor;
            NEXT static_label_item: [fmc$file_processor] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  file_processor_source;
            put_name (static_label_attributes.file_processor);
          IFEND;
        = fmc$file_structure =
          IF NOT(static_label_attributes.file_structure_source IN
                unspecified_sources) OR (static_label_attributes.file_structure <>
                default_file_attributes.file_structure) THEN
            header^.attribute_present [fmc$file_structure] := TRUE;
            header^.highest_attribute_present := fmc$file_structure;
            NEXT static_label_item: [fmc$file_structure] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  file_structure_source;
            put_name (static_label_attributes.file_structure);
          IFEND;
        = fmc$forced_write =
          IF NOT(static_label_attributes.forced_write_source IN
                unspecified_sources) OR (static_label_attributes.forced_write <>
                default_file_attributes.forced_write) THEN
            header^.attribute_present [fmc$forced_write] := TRUE;
            header^.highest_attribute_present := fmc$forced_write;
            NEXT static_label_item: [fmc$forced_write] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  forced_write_source;
            static_label_item^.forced_write := static_label_attributes.
                  forced_write;
          IFEND;
        = fmc$internal_code =
          IF NOT(static_label_attributes.internal_code_source IN
                unspecified_sources) OR (static_label_attributes.internal_code <>
                default_file_attributes.internal_code) THEN
            header^.attribute_present [fmc$internal_code] := TRUE;
            header^.highest_attribute_present := fmc$internal_code;
            NEXT static_label_item: [fmc$internal_code] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  internal_code_source;
            static_label_item^.internal_code := static_label_attributes.
                  internal_code;
          IFEND;
        = fmc$label_type =
          IF NOT(static_label_attributes.label_type_source IN
                unspecified_sources) OR (static_label_attributes.label_type <>
                default_file_attributes.label_type) THEN
            header^.attribute_present [fmc$label_type] := TRUE;
            header^.highest_attribute_present := fmc$label_type;
            NEXT static_label_item: [fmc$label_type] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  label_type_source;
            static_label_item^.label_type := static_label_attributes.
                  label_type;
          IFEND;
        = fmc$line_number =
          IF NOT(static_label_attributes.line_number_source IN
                unspecified_sources) OR (static_label_attributes.line_number <>
                default_file_attributes.line_number) THEN
            header^.attribute_present [fmc$line_number] := TRUE;
            header^.highest_attribute_present := fmc$line_number;
            NEXT static_label_item: [fmc$line_number] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  line_number_source;
            static_label_item^.line_number := static_label_attributes.
                  line_number;
          IFEND;
        = fmc$max_block_length =
          IF NOT(static_label_attributes.max_block_length_source IN
                unspecified_sources) OR (static_label_attributes.max_block_length <>
                default_file_attributes.max_block_length) THEN
            header^.attribute_present [fmc$max_block_length] := TRUE;
            header^.highest_attribute_present := fmc$max_block_length;
            NEXT static_label_item: [fmc$max_block_length] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  max_block_length_source;
            static_label_item^.integer_value := static_label_attributes.
                  max_block_length;
          IFEND;
        = fmc$max_record_length =
          IF NOT(static_label_attributes.max_record_length_source IN
                unspecified_sources) OR (static_label_attributes.max_record_length <>
                default_file_attributes.max_record_length) THEN
            header^.attribute_present [fmc$max_record_length] := TRUE;
            header^.highest_attribute_present := fmc$max_record_length;
            NEXT static_label_item: [fmc$max_record_length] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  max_record_length_source;
            static_label_item^.integer_value := static_label_attributes.
                  max_record_length;
          IFEND;
        = fmc$min_block_length =
          IF NOT(static_label_attributes.min_block_length_source IN
                unspecified_sources) OR (static_label_attributes.min_block_length <>
                default_file_attributes.min_block_length) THEN
            header^.attribute_present [fmc$min_block_length] := TRUE;
            header^.highest_attribute_present := fmc$min_block_length;
            NEXT static_label_item: [fmc$min_block_length] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  min_block_length_source;
            static_label_item^.integer_value := static_label_attributes.
                  min_block_length;
          IFEND;
        = fmc$min_record_length =
          IF NOT(static_label_attributes.min_record_length_source IN
                unspecified_sources) OR (static_label_attributes.min_record_length <>
                default_file_attributes.min_record_length) THEN
            header^.attribute_present [fmc$min_record_length] := TRUE;
            header^.highest_attribute_present := fmc$min_record_length;
            NEXT static_label_item: [fmc$min_record_length] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  min_record_length_source;
            static_label_item^.integer_value := static_label_attributes.
                  min_record_length;
          IFEND;
        = fmc$padding_character =
          IF NOT(static_label_attributes.padding_character_source IN
                unspecified_sources) OR (static_label_attributes.padding_character <>
                default_file_attributes.padding_character) THEN
            header^.attribute_present [fmc$padding_character] := TRUE;
            header^.highest_attribute_present := fmc$padding_character;
            NEXT static_label_item: [fmc$padding_character] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  padding_character_source;
            static_label_item^.padding_character := static_label_attributes.
                  padding_character;
          IFEND;
        = fmc$page_format =
          IF NOT(static_label_attributes.page_format_source IN
                unspecified_sources) OR (static_label_attributes.page_format <>
                default_file_attributes.page_format) THEN
            header^.attribute_present [fmc$page_format] := TRUE;
            header^.highest_attribute_present := fmc$page_format;
            NEXT static_label_item: [fmc$page_format] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  page_format_source;
            static_label_item^.page_format := static_label_attributes.
                  page_format;
          IFEND;
        = fmc$page_length =
          IF NOT(static_label_attributes.page_length_source IN
                unspecified_sources) OR (static_label_attributes.page_length <>
                default_file_attributes.page_length) THEN
            header^.attribute_present [fmc$page_length] := TRUE;
            header^.highest_attribute_present := fmc$page_length;
            NEXT static_label_item: [fmc$page_length] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  page_length_source;
            static_label_item^.integer_value := static_label_attributes.
                  page_length;
          IFEND;
        = fmc$page_width =
          IF NOT(static_label_attributes.page_width_source IN
                unspecified_sources) OR (static_label_attributes.page_width <>
                default_file_attributes.page_width) THEN
            header^.attribute_present [fmc$page_width] := TRUE;
            header^.highest_attribute_present := fmc$page_width;
            NEXT static_label_item: [fmc$page_width] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  page_width_source;
            static_label_item^.integer_value := static_label_attributes.
                  page_width;
          IFEND;
        = fmc$preset_value =
          IF NOT(static_label_attributes.preset_value_source IN
                unspecified_sources) OR (static_label_attributes.preset_value <>
                default_file_attributes.preset_value) THEN
            header^.attribute_present [fmc$preset_value] := TRUE;
            header^.highest_attribute_present := fmc$preset_value;
            NEXT static_label_item: [fmc$preset_value] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  preset_value_source;
            static_label_item^.integer_value := static_label_attributes.
                  preset_value;
          IFEND;
        = fmc$record_delimiting_character =
          IF NOT(static_label_attributes.record_delimiting_char_source IN
                unspecified_sources) OR (static_label_attributes.record_delimiting_character <>
                default_file_attributes.record_delimiting_character) THEN
            header^.attribute_present [fmc$record_delimiting_character] := TRUE;
            header^.highest_attribute_present := fmc$record_delimiting_character;
            NEXT static_label_item: [fmc$record_delimiting_character] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  record_delimiting_char_source;
            static_label_item^.record_delimiting_character := static_label_attributes.
                  record_delimiting_character;
          IFEND;
        = fmc$record_type =
          IF NOT(static_label_attributes.record_type_source IN
                unspecified_sources) OR (static_label_attributes.record_type <>
                default_file_attributes.record_type) THEN
            header^.attribute_present [fmc$record_type] := TRUE;
            header^.highest_attribute_present := fmc$record_type;
            NEXT static_label_item: [fmc$record_type] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  record_type_source;
            static_label_item^.record_type := static_label_attributes.
                  record_type;
          IFEND;
        = fmc$ring_attributes =
          IF NOT(static_label_attributes.ring_attributes_source IN
                unspecified_sources) OR (static_label_attributes.ring_attributes <>
                default_file_attributes.ring_attributes) THEN
            header^.attribute_present [fmc$ring_attributes] := TRUE;
            header^.highest_attribute_present := fmc$ring_attributes;
          IFEND;
          { ring_attributes are stored in the header - see below, after FOR loop }
        = fmc$statement_identifier =
          IF NOT(static_label_attributes.statement_identifier_source IN
                unspecified_sources) OR (static_label_attributes.statement_identifier <>
                default_file_attributes.statement_identifier) THEN
            header^.attribute_present [fmc$statement_identifier] := TRUE;
            header^.highest_attribute_present := fmc$statement_identifier;
            NEXT static_label_item: [fmc$statement_identifier] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  statement_identifier_source;
            static_label_item^.statement_identifier := static_label_attributes.
                  statement_identifier;
          IFEND;
        = fmc$user_info =
          IF NOT(static_label_attributes.user_info_source IN
                unspecified_sources) OR (static_label_attributes.user_info <>
                default_file_attributes.user_info) THEN
            header^.attribute_present [fmc$user_info] := TRUE;
            header^.highest_attribute_present := fmc$user_info;
            NEXT static_label_item: [fmc$user_info] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  user_info_source;
            static_label_item^.user_info_present := TRUE;
            NEXT str: [32] IN stack_seq;
            str^ (1, 32) := static_label_attributes.user_info;
          IFEND;
        = fmc$vertical_print_density =
          IF NOT(static_label_attributes.vertical_print_density_source IN
                unspecified_sources) OR (static_label_attributes.vertical_print_density <>
                default_file_attributes.vertical_print_density) THEN
            header^.attribute_present [fmc$vertical_print_density] := TRUE;
            header^.highest_attribute_present := fmc$vertical_print_density;
            NEXT static_label_item: [fmc$vertical_print_density] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  vertical_print_density_source;
            static_label_item^.integer_value := static_label_attributes.
                  vertical_print_density;
          IFEND;
        = fmc$average_record_length =
          IF NOT(static_label_attributes.average_record_length_source IN
                unspecified_sources) OR (static_label_attributes.average_record_length <>
                default_file_attributes.average_record_length) THEN
            header^.attribute_present [fmc$average_record_length] := TRUE;
            header^.highest_attribute_present := fmc$average_record_length;
            NEXT static_label_item: [fmc$average_record_length] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  average_record_length_source;
            static_label_item^.integer_value := static_label_attributes.
                  average_record_length;
          IFEND;
        = fmc$collate_table =
          p_cell := ^static_label_attributes.collate_table;
          p_specified_string := p_cell;
          p_cell := ^default_file_attributes.collate_table;
          p_default_string := p_cell;
          IF NOT(static_label_attributes.collate_table_source IN
                unspecified_sources) OR (p_specified_string^ (1, #SIZE (amt$collate_table)) <>
                p_default_string^ (1, #SIZE (amt$collate_table))) THEN
            header^.attribute_present [fmc$collate_table] := TRUE;
            header^.highest_attribute_present := fmc$collate_table;
            NEXT static_label_item: [fmc$collate_table] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  collate_table_source;
            static_label_item^.collate_table := static_label_attributes.
                  collate_table;
          IFEND;
        = fmc$collate_table_name =
          IF NOT(static_label_attributes.collate_table_name_source IN
                unspecified_sources) OR (static_label_attributes.collate_table_name <>
                default_file_attributes.collate_table_name) THEN
            header^.attribute_present [fmc$collate_table_name] := TRUE;
            header^.highest_attribute_present := fmc$collate_table_name;
            NEXT static_label_item: [fmc$collate_table_name] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  collate_table_name_source;
            put_entry_point_reference (static_label_attributes.collate_table_name,
                  osc$null_name);
          IFEND;
        = fmc$compression_procedure_name =
          IF NOT(static_label_attributes.compression_proc_name_source IN
                unspecified_sources) OR (static_label_attributes.
                compression_procedure_name <> fmv$system_file_attributes.
                static_label.compression_procedure_name) THEN
            header^.attribute_present [fmc$compression_procedure_name] :=
                  TRUE;
            header^.highest_attribute_present := fmc$compression_procedure_name;
            NEXT static_label_item: [fmc$compression_procedure_name] IN
                  stack_seq;
            static_label_item^.source := static_label_attributes.
                  compression_proc_name_source;
            put_entry_point_reference (static_label_attributes.
                  compression_procedure_name.name, static_label_attributes.
                  compression_procedure_name.object_library);
          IFEND;
        = fmc$data_padding =
          IF NOT(static_label_attributes.data_padding_source IN
                unspecified_sources) OR (static_label_attributes.data_padding <>
                default_file_attributes.data_padding) THEN
            header^.attribute_present [fmc$data_padding] := TRUE;
            header^.highest_attribute_present := fmc$data_padding;
            NEXT static_label_item: [fmc$data_padding] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  data_padding_source;
            static_label_item^.data_padding := static_label_attributes.
                  data_padding;
          IFEND;
        = fmc$dynamic_home_block_space =
          IF NOT(static_label_attributes.dynamic_home_block_space_source IN
                unspecified_sources) OR (static_label_attributes.
                dynamic_home_block_space <> fmv$system_file_attributes.
                static_label.dynamic_home_block_space) THEN
            header^.attribute_present [fmc$dynamic_home_block_space] := TRUE;
            header^.highest_attribute_present := fmc$dynamic_home_block_space;
            NEXT static_label_item: [fmc$dynamic_home_block_space] IN
                  stack_seq;
            static_label_item^.source := static_label_attributes.
                  dynamic_home_block_space_source;
            static_label_item^.dynamic_home_block_space :=
                  static_label_attributes.dynamic_home_block_space;
          IFEND;
        = fmc$embedded_key =
          IF NOT(static_label_attributes.embedded_key_source IN
                unspecified_sources) OR (static_label_attributes.embedded_key <>
                default_file_attributes.embedded_key) THEN
            header^.attribute_present [fmc$embedded_key] := TRUE;
            header^.highest_attribute_present := fmc$embedded_key;
            NEXT static_label_item: [fmc$embedded_key] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  embedded_key_source;
            static_label_item^.embedded_key := static_label_attributes.
                  embedded_key;
          IFEND;
        = fmc$estimated_record_count =
          IF NOT(static_label_attributes.estimated_record_count_source IN
                unspecified_sources) OR (static_label_attributes.estimated_record_count <>
                default_file_attributes.estimated_record_count) THEN
            header^.attribute_present [fmc$estimated_record_count] := TRUE;
            header^.highest_attribute_present := fmc$estimated_record_count;
            NEXT static_label_item: [fmc$estimated_record_count] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  estimated_record_count_source;
            static_label_item^.integer_value := static_label_attributes.
                  estimated_record_count;
          IFEND;
        = fmc$hashing_procedure_name =
          IF NOT(static_label_attributes.hashing_procedure_name_source IN
                unspecified_sources) OR (static_label_attributes.hashing_procedure_name <>
                default_file_attributes.hashing_procedure_name) THEN
            header^.attribute_present [fmc$hashing_procedure_name] := TRUE;
            header^.highest_attribute_present := fmc$hashing_procedure_name;
            NEXT static_label_item: [fmc$hashing_procedure_name] IN
                  stack_seq;
            static_label_item^.source := static_label_attributes.
                  hashing_procedure_name_source;
            put_entry_point_reference (static_label_attributes.
                  hashing_procedure_name.name, static_label_attributes.
                  hashing_procedure_name.object_library);
          IFEND;
        = fmc$index_levels =
          IF NOT(static_label_attributes.index_levels_source IN
                unspecified_sources) OR (static_label_attributes.index_levels <>
                default_file_attributes.index_levels) THEN
            header^.attribute_present [fmc$index_levels] := TRUE;
            header^.highest_attribute_present := fmc$index_levels;
            NEXT static_label_item: [fmc$index_levels] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  index_levels_source;
            static_label_item^.integer_value := static_label_attributes.
                  index_levels;
          IFEND;
        = fmc$index_padding =
          IF NOT(static_label_attributes.index_padding_source IN
                unspecified_sources) OR (static_label_attributes.index_padding <>
                default_file_attributes.index_padding) THEN
            header^.attribute_present [fmc$index_padding] := TRUE;
            header^.highest_attribute_present := fmc$index_padding;
            NEXT static_label_item: [fmc$index_padding] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  index_padding_source;
            static_label_item^.index_padding := static_label_attributes.
                  index_padding;
          IFEND;
        = fmc$initial_home_block_count =
          IF NOT(static_label_attributes.initial_home_block_count_source IN
                unspecified_sources) OR (static_label_attributes.
                initial_home_block_count <> fmv$system_file_attributes.
                static_label.initial_home_block_count) THEN
            header^.attribute_present [fmc$initial_home_block_count] := TRUE;
            header^.highest_attribute_present := fmc$initial_home_block_count;
            NEXT static_label_item: [fmc$initial_home_block_count] IN
                  stack_seq;
            static_label_item^.source := static_label_attributes.
                  initial_home_block_count_source;
            static_label_item^.integer_value :=
                  static_label_attributes.initial_home_block_count;
          IFEND;
        = fmc$key_length =
          IF NOT(static_label_attributes.key_length_source IN
                unspecified_sources) OR (static_label_attributes.key_length <>
                default_file_attributes.key_length) THEN
            header^.attribute_present [fmc$key_length] := TRUE;
            header^.highest_attribute_present := fmc$key_length;
            NEXT static_label_item: [fmc$key_length] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  key_length_source;
            static_label_item^.integer_value := static_label_attributes.
                  key_length;
          IFEND;
        = fmc$key_position =
          IF NOT(static_label_attributes.key_position_source IN
                unspecified_sources) OR (static_label_attributes.key_position <>
                default_file_attributes.key_position) THEN
            header^.attribute_present [fmc$key_position] := TRUE;
            header^.highest_attribute_present := fmc$key_position;
            NEXT static_label_item: [fmc$key_position] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  key_position_source;
            static_label_item^.integer_value := static_label_attributes.
                  key_position;
          IFEND;
        = fmc$key_type =
          IF NOT(static_label_attributes.key_type_source IN
                unspecified_sources) OR (static_label_attributes.key_type <>
                default_file_attributes.key_type) THEN
            header^.attribute_present [fmc$key_type] := TRUE;
            header^.highest_attribute_present := fmc$key_type;
            NEXT static_label_item: [fmc$key_type] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  key_type_source;
            static_label_item^.key_type := static_label_attributes.
                  key_type;
          IFEND;
        = fmc$loading_factor =
          IF NOT(static_label_attributes.loading_factor_source IN
                unspecified_sources) OR (static_label_attributes.loading_factor <>
                default_file_attributes.loading_factor) THEN
            header^.attribute_present [fmc$loading_factor] := TRUE;
            header^.highest_attribute_present := fmc$loading_factor;
            NEXT static_label_item: [fmc$loading_factor] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  loading_factor_source;
            static_label_item^.loading_factor := static_label_attributes.
                  loading_factor;
          IFEND;
        = fmc$lock_expiration_time =
          IF NOT(static_label_attributes.lock_expiration_time_source IN
                unspecified_sources) OR (static_label_attributes.lock_expiration_time <>
                default_file_attributes.lock_expiration_time) THEN
            header^.attribute_present [fmc$lock_expiration_time] := TRUE;
            header^.highest_attribute_present := fmc$lock_expiration_time;
            NEXT static_label_item: [fmc$lock_expiration_time] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  lock_expiration_time_source;
            static_label_item^.integer_value := static_label_attributes.
                  lock_expiration_time;
          IFEND;
        = fmc$logging_options =
          IF NOT(static_label_attributes.logging_options_source IN
                unspecified_sources) OR (static_label_attributes.logging_options <>
                default_file_attributes.logging_options) THEN
            header^.attribute_present [fmc$logging_options] := TRUE;
            header^.highest_attribute_present := fmc$logging_options;
            NEXT static_label_item: [fmc$logging_options] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  logging_options_source;
            static_label_item^.logging_options := static_label_attributes.
                  logging_options;
          IFEND;
        = fmc$log_residence =
          IF NOT(static_label_attributes.log_residence_source IN
                unspecified_sources) OR (static_label_attributes.log_residence <>
                default_file_attributes.log_residence) THEN
            header^.attribute_present [fmc$log_residence] := TRUE;
            header^.highest_attribute_present := fmc$log_residence;
            NEXT static_label_item: [fmc$log_residence] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  log_residence_source;
            #SCAN (space_selector, static_label_attributes.log_residence,
                  path_index, ignore_found);
            static_label_item^.path_length := path_index - 1;
            NEXT str: [static_label_item^.path_length] IN stack_seq;
            str^ (1, static_label_item^.path_length) :=
                  static_label_attributes.log_residence;
          IFEND;
        = fmc$record_limit =
          IF NOT(static_label_attributes.record_limit_source IN
                unspecified_sources) OR (static_label_attributes.record_limit <>
                default_file_attributes.record_limit) THEN
            header^.attribute_present [fmc$record_limit] := TRUE;
            header^.highest_attribute_present := fmc$record_limit;
            NEXT static_label_item: [fmc$record_limit] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  record_limit_source;
            static_label_item^.integer_value := static_label_attributes.
                  record_limit;
          IFEND;
        = fmc$records_per_block =
          IF NOT(static_label_attributes.records_per_block_source IN
                unspecified_sources) OR (static_label_attributes.records_per_block <>
                default_file_attributes.records_per_block) THEN
            header^.attribute_present [fmc$records_per_block] := TRUE;
            header^.highest_attribute_present := fmc$records_per_block;
            NEXT static_label_item: [fmc$records_per_block] IN stack_seq;
            static_label_item^.source := static_label_attributes.
                  records_per_block_source;
            static_label_item^.integer_value := static_label_attributes.
                  records_per_block;
          IFEND;
        ELSE
        CASEND;
      FOREND;
      IF header^.highest_attribute_present <> 0 THEN
        header^.file_previously_opened := system_file_label.file_previously_opened;
        header^.ring_attributes_source := static_label_attributes.ring_attributes_source;
        header^.ring_attributes := static_label_attributes.ring_attributes;
        static_label_size := i#current_sequence_position (stack_seq);
        ALLOCATE system_file_label.static_label: [[REP static_label_size
              OF cell]] IN osv$job_pageable_heap^;
        RESET stack_seq;
        RESET system_file_label.static_label;
        i#move (stack_seq, system_file_label.static_label,
              static_label_size);
      IFEND;
    ELSE { default file }
      system_file_label.static_label := NIL;
    IFEND;

  PROCEND fmp$put_label_attributes;


?? TITLE := '[XDCL] fmp$get_label_attributes', EJECT ??

  PROCEDURE [XDCL, #GATE] fmp$get_label_attributes (system_file_label:
    ^fmt$system_file_label;
    VAR static_label_attributes: bat$static_label_attributes;
    VAR status: ost$status);

    VAR
      file_previously_opened: boolean;

    status.normal := TRUE;

    IF system_file_label^.static_label <> NIL THEN
      fsp$expand_file_label (system_file_label^.static_label, static_label_attributes, file_previously_opened,
            status);
    ELSE
      IF fmv$default_file_attributes = NIL THEN
        static_label_attributes := fmv$system_file_attributes.static_label;
      ELSE
        static_label_attributes := fmv$default_file_attributes^;
      IFEND;
    IFEND;

  PROCEND fmp$get_label_attributes;

MODEND fmm$file_label_functions;

