?? RIGHT := 110 ??
MODULE fmm$get_open_information;
*copyc osd$default_pragmats
?? NEWTITLE := 'MODULE fmm$get_open_information' ??
?? EJECT ??
?? PUSH (LISTEXT := ON) ??
?? NEWTITLE := 'Decks global definitions' ??
?? EJECT ??
*copyc amc$condition_code_limits
*copyc ame$attribute_validation_errors
*copyc ame$improper_file_id
*copyc ame$ring_validation_errors
*copyc bat$task_file_table
*copyc fmc$unique_label_id
*copyc fmt$file_attribute_keys
*copyc fmt$static_label_header
*copyc fmt$static_label_item
*copyc fse$get_info_validation_errors
*copyc fst$attachment_information
*copyc fst$catalog_information
*copyc fst$cycle_attribute_sources
*copyc fst$cycle_attribute_values
*copyc fst$open_instance_information
*copyc fst$path
*copyc fst$resolved_file_reference
*copyc fst$user_attribute_descriptor
*copyc fst$user_defined_attribute_size
*copyc pmt$program_name
?? POP ??

*copyc i#move
*copyc amp$set_file_instance_abnormal
*copyc baf$task_file_entry_p
*copyc bap$get_default_attributes
*copyc clp$check_name_for_path_handle
*copyc clp$trimmed_string_size
*copyc fmp$get_resolved_file_reference
*copyc iip$get_page_length_width
*copyc osp$append_status_parameter
*copyc osp$fetch_locked_variable
*copyc osp$set_status_abnormal

*copyc clv$standard_files
*copyc fsv$evaluated_file_reference
?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE fsp$convert_to_old_contents' ??
?? EJECT ??
*copyc fsp$convert_to_old_contents
?? TITLE := 'PROCEDURE fsp$convert_to_new_contents' ??
?? EJECT ??
*copyc fsp$convert_to_new_contents

?? TITLE := 'PROCEDURE fmp$get_open_information' ??
?? EJECT ??
*copyc fmh$get_open_information
*copyc amt$file_identifier
*copyc osd$integer_limits
*copyc ost$status

?? EJECT ??

  PROCEDURE [XDCL, #GATE] fmp$get_open_information (file_identifier: amt$file_identifier;
        attachment_information: ^SEQ ( * );
        catalog_information: ^SEQ ( * );
        cycle_attribute_sources: ^SEQ ( * );
        cycle_attribute_values: ^SEQ ( * );
        instance_information: ^SEQ ( * );
        resolved_file_reference: ^SEQ ( * );
        user_defined_attributes: ^SEQ ( * );
    VAR user_defined_attribute_size: ost$non_negative_integers;
    VAR status: ost$status);

    VAR
      attachment_info_requested: boolean,
      attachment_information_rec: fst$attachment_information,
      attachment_information_seq: ^SEQ ( * ),
      attribute_key: fmt$file_attribute_keys,
      attribute_sources_requested: boolean,
      attribute_values_requested: boolean,
      catalog_info_requested: boolean,
      catalog_information_rec: fst$catalog_information,
      catalog_information_seq: ^SEQ ( * ),
      cl_path_handle: clt$path_handle,
      cycle_attribute_sources_rec: fst$cycle_attribute_sources,
      cycle_attribute_sources_seq: ^SEQ ( * ),
      cycle_attribute_values_rec: fst$cycle_attribute_values,
      cycle_attribute_values_seq: ^SEQ ( * ),
      file_contents_truncated: boolean,
      file_instance: ^bat$task_file_entry,
      header: ^fmt$static_label_header,
      instance_info_requested: boolean,
      instance_information_rec: fst$open_instance_information,
      instance_information_seq: ^SEQ ( * ),
      oldest_target_file_instance: ^bat$task_file_entry,
      p_evaluated_file_reference: ^fst$evaluated_file_reference,
      resolved_file_reference_rec: fst$resolved_file_reference,
      resolved_file_reference_seq: ^SEQ ( * ),
      resolved_reference_requested: boolean,
      static_file_contents: amt$file_contents,
      static_file_structure: amt$file_structure,
      static_label: ^SEQ ( * ),
      static_label_item: ^fmt$static_label_item,
      status_text: string (osc$max_string_size),
      status_text_size: integer,
      str: ^string ( * ),
      target_file_identifier: amt$file_identifier,
      target_file_instance: ^bat$task_file_entry, { currently known last target of 'file_instance' }
      terminal_attributes: array [1 .. 2] of ift$terminal_attribute,
      tape_descriptor: ^bat$tape_descriptor,
      tape_descriptor_sequence_ptr: ^SEQ ( * ),
      user_defined_info_requested: boolean;

?? NEWTITLE := '  PROCEDURE set_status_damaged_attributes' ??
?? EJECT ??

    PROCEDURE set_status_damaged_attributes (error_number: ost$non_negative_integers;
      VAR status: ost$status);

      VAR
        status_text: string (osc$max_string_size),
        text_length: integer;

      STRINGREP (status_text, text_length, 'detected damaged label error #', error_number,
        ' in fmm$get_open_information');
      amp$set_file_instance_abnormal (file_identifier, fse$get_file_info_internal,
            fsc$get_open_information_req, status_text (1, text_length), status);

    PROCEND set_status_damaged_attributes;

?? TITLE := '  PROCEDURE set_status_bad_data_mapping' ??
?? EJECT ??

    PROCEDURE set_status_bad_data_mapping (error_text: string ( * );
      VAR status: ost$status);

      VAR
        status_text: string (130),
        text_length: integer;

      STRINGREP (status_text, text_length, 'Detected error in fmm$get_open_information - ',
        'bad data mapping of ', error_text);
      amp$set_file_instance_abnormal (file_identifier, fse$get_file_info_internal,
            fsc$get_open_information_req, status_text (1, text_length), status);

    PROCEND set_status_bad_data_mapping;

?? TITLE := '  PROCEDURE get_entry_point_reference' ??
?? EJECT ??

    PROCEDURE [INLINE] get_entry_point_reference (VAR name: pmt$program_name;
      VAR path: fst$path;
      VAR status: ost$status);
      NEXT str: [static_label_item^.entry_point_name_length] IN static_label;
      IF str = NIL THEN
        set_status_damaged_attributes (1, status);
        RETURN;
      IFEND;
      name := str^;
      IF static_label_item^.entry_point_path_length > 0 THEN
        NEXT str: [static_label_item^.entry_point_path_length] IN static_label;
        IF str = NIL THEN
          set_status_damaged_attributes (2, status);
          RETURN;
        IFEND;
        path := str^;
      IFEND;
    PROCEND get_entry_point_reference;

?? TITLE := '  PROCEDURE get_name' ??
?? EJECT ??

    PROCEDURE [INLINE] get_name (VAR name: pmt$program_name;
      VAR status: ost$status);

      NEXT str: [static_label_item^.name_length] IN static_label;
      IF str = NIL THEN
        set_status_damaged_attributes (3, status);
        RETURN;
      IFEND;
      name := str^;
    PROCEND get_name;
?? OLDTITLE ??

    status.normal := TRUE;

    file_contents_truncated := FALSE;

    attribute_values_requested := (cycle_attribute_values <> NIL);
    attribute_sources_requested := (cycle_attribute_sources <> NIL);
    catalog_info_requested := (catalog_information <> NIL);
    attachment_info_requested := (attachment_information <> NIL);
    instance_info_requested := (instance_information <> NIL);
    resolved_reference_requested := (resolved_file_reference <> NIL);
    user_defined_info_requested := (user_defined_attributes <> NIL);
    user_defined_attribute_size := 0;

    file_instance := baf$task_file_entry_p (file_identifier);
    IF file_instance = NIL THEN
      osp$set_status_abnormal (amc$access_method_id, ame$improper_file_id, 'FSP$GET_OPEN_INFORMATION',
            status);
      RETURN;
    IFEND;
    oldest_target_file_instance := file_instance;

{  Check if the file is the subject of a file connection, if so find the oldest target file.

  /find_ultimate_target/
    WHILE (oldest_target_file_instance^.device_class = rmc$connected_file_device) AND
          oldest_target_file_instance^.first_target.defined DO

      target_file_identifier := oldest_target_file_instance^.first_target.file_identifier;
      target_file_instance := NIL;

{  Look for the last target file of file_instance.

    /find_oldest_target/
      WHILE TRUE DO
        target_file_instance := baf$task_file_entry_p (target_file_identifier);
        IF target_file_instance = NIL THEN
          osp$set_status_abnormal (amc$access_method_id, ame$improper_file_id, 'FMP$GET_OPEN_INFORMATION',
                status);
          RETURN;
        IFEND;

        IF target_file_instance^.next_target.defined THEN
          target_file_identifier := target_file_instance^.next_target.file_identifier;
        ELSE
          EXIT /find_oldest_target/; {oldest target has been found}
        IFEND;
      WHILEND /find_oldest_target/;

{  If target_file_instance is not NIL, then it is the last target.  Then it must be check whether it
{  is also the subject of a connected file.

      IF (target_file_instance <> NIL) AND (target_file_instance^.local_file_name <>
            clv$standard_files [clc$sf_null_file].path_handle_name) THEN
        oldest_target_file_instance := target_file_instance;
      ELSE
        EXIT /find_ultimate_target/;
      IFEND;
    WHILEND /find_ultimate_target/;

    IF attachment_info_requested THEN
      osp$fetch_locked_variable (file_instance^.global_file_information^.open_count,
            attachment_information_rec.usage_information.concurrent_open_count);
      #unchecked_conversion (file_instance^.system_file_label^.descriptive_label.global_access_mode,
            attachment_information_rec.administration_information.attached_access_modes);
      #unchecked_conversion (file_instance^.system_file_label^.descriptive_label.global_share_mode,
            attachment_information_rec.administration_information.attached_share_modes);
      attachment_information_rec.usage_information.private_read :=
            (file_instance^.private_read_information <> NIL);
    IFEND;

    IF instance_info_requested THEN
      #unchecked_conversion (file_instance^.instance_attributes.dynamic_label.access_mode,
            instance_information_rec.attachment_information.access_modes);
      #unchecked_conversion (file_instance^.instance_attributes.dynamic_label.open_share_modes,
            instance_information_rec.attachment_information.open_share_modes);
      instance_information_rec.attachment_information.open_position := file_instance^.instance_attributes.
            dynamic_label.open_position;
      instance_information_rec.attachment_information.private_read :=
            (file_instance^.private_read_information <> NIL);
    IFEND;

    IF attribute_values_requested OR attribute_sources_requested OR catalog_info_requested OR
          user_defined_info_requested THEN

      bap$get_default_attributes (^catalog_information_rec, ^cycle_attribute_sources_rec,
            ^cycle_attribute_values_rec, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;


      IF catalog_info_requested THEN
        catalog_information_rec.cycle_registration.size := oldest_target_file_instance^.
              global_file_information^.eoi_byte_address;
        catalog_information_rec.cycle_registration.residence.device_class := file_instance^.device_class;
      IFEND;


      static_label := oldest_target_file_instance^.system_file_label^.static_label;

      IF static_label <> NIL THEN
        RESET static_label;
        NEXT header IN static_label;
        IF (header = NIL) OR (header^.unique_character <> fmc$unique_label_id) THEN
          set_status_damaged_attributes (4, status);
          RETURN;
        IFEND;
        IF header^.file_previously_opened THEN
          catalog_information_rec.cycle_registration.ring_attributes := header^.ring_attributes;
        IFEND;
        IF header^.highest_attribute_present > 0 THEN
          fsp$convert_to_old_contents (cycle_attribute_values_rec.file_contents, static_file_contents,
                static_file_structure);

          FOR attribute_key := LOWERBOUND (header^.attribute_present) TO header^.highest_attribute_present DO
            CASE attribute_key OF
            = fmc$average_record_length =
              IF header^.attribute_present [fmc$average_record_length] THEN
                NEXT static_label_item: [fmc$average_record_length] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (5, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.average_record_length := static_label_item^.source;
                cycle_attribute_values_rec.average_record_length := static_label_item^.integer_value;
              IFEND;
            = fmc$block_type =
              IF header^.attribute_present [fmc$block_type] THEN
                NEXT static_label_item: [fmc$block_type] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (6, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.block_type := static_label_item^.source;
                cycle_attribute_values_rec.block_type := static_label_item^.block_type;
              IFEND;
            = fmc$character_conversion =
              IF header^.attribute_present [fmc$character_conversion] THEN
                NEXT static_label_item: [fmc$character_conversion] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (7, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.character_conversion := static_label_item^.source;
                cycle_attribute_values_rec.character_conversion := static_label_item^.character_conversion;
              IFEND;
            = fmc$clear_space =
              IF header^.attribute_present [fmc$clear_space] THEN
                NEXT static_label_item: [fmc$clear_space] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (8, status);
                  RETURN;
                IFEND;
                catalog_information_rec.cycle_registration.erase_at_deletion := static_label_item^.
                      clear_space;
              IFEND;
            = fmc$collate_table =
              IF header^.attribute_present [fmc$collate_table] THEN
                NEXT static_label_item: [fmc$collate_table] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (9, status);
                  RETURN;
                IFEND;
              IFEND;
            = fmc$collate_table_name =
              IF header^.attribute_present [fmc$collate_table_name] THEN
                NEXT static_label_item: [fmc$collate_table_name] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (10, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.collate_table_name := static_label_item^.source;
                get_entry_point_reference (cycle_attribute_values_rec.collate_table_name.entry_point,
                      cycle_attribute_values_rec.collate_table_name.object_library, status);
                IF NOT status.normal THEN
                  set_status_damaged_attributes (11, status);
                  RETURN;
                IFEND;
              IFEND;
            = fmc$compression_procedure_name =
              IF header^.attribute_present [fmc$compression_procedure_name] THEN
                NEXT static_label_item: [fmc$compression_procedure_name] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (12, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.compression_procedure_name := static_label_item^.source;
                get_entry_point_reference (cycle_attribute_values_rec.compression_procedure_name.entry_point,
                      cycle_attribute_values_rec.compression_procedure_name.object_library, status);
                IF NOT status.normal THEN
                  set_status_damaged_attributes (13, status);
                  RETURN;
                IFEND;
              IFEND;
            = fmc$data_padding =
              IF header^.attribute_present [fmc$data_padding] THEN
                NEXT static_label_item: [fmc$data_padding] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (14, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.data_padding := static_label_item^.source;
                cycle_attribute_values_rec.data_padding := static_label_item^.data_padding;
              IFEND;
            = fmc$dynamic_home_block_space =
              IF header^.attribute_present [fmc$dynamic_home_block_space] THEN
                NEXT static_label_item: [fmc$dynamic_home_block_space] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (15, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.dynamic_home_block_space := static_label_item^.source;
                cycle_attribute_values_rec.dynamic_home_block_space := static_label_item^.
                      dynamic_home_block_space;
              IFEND;
            = fmc$embedded_key =
              IF header^.attribute_present [fmc$embedded_key] THEN
                NEXT static_label_item: [fmc$embedded_key] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (16, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.embedded_key := static_label_item^.source;
                cycle_attribute_values_rec.embedded_key := static_label_item^.embedded_key;
              IFEND;
            = fmc$estimated_record_count =
              IF header^.attribute_present [fmc$estimated_record_count] THEN
                NEXT static_label_item: [fmc$estimated_record_count] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (17, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.estimated_record_count := static_label_item^.source;
                cycle_attribute_values_rec.estimated_record_count := static_label_item^.integer_value;
              IFEND;
            = fmc$file_access_procedure =
              IF header^.attribute_present [fmc$file_access_procedure] THEN
                NEXT static_label_item: [fmc$file_access_procedure] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (18, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.file_access_procedure_name := static_label_item^.source;
                get_entry_point_reference (cycle_attribute_values_rec.file_access_procedure_name.entry_point,
                      cycle_attribute_values_rec.file_access_procedure_name.object_library, status);
                IF NOT status.normal THEN
                  set_status_damaged_attributes (19, status);
                  RETURN;
                IFEND;
              IFEND;
            = fmc$file_contents =
              IF header^.attribute_present [fmc$file_contents] THEN
                NEXT static_label_item: [fmc$file_contents] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (20, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.file_contents := static_label_item^.source;
                get_name (static_file_contents, status);
                IF NOT status.normal THEN
                  set_status_damaged_attributes (21, status);
                  RETURN;
                IFEND;
              IFEND;
            = fmc$file_limit =
              IF header^.attribute_present [fmc$file_limit] THEN
                NEXT static_label_item: [fmc$file_limit] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (22, status);
                  RETURN;
                IFEND;
                catalog_information_rec.cycle_registration.size_limit := static_label_item^.integer_value;
              IFEND;
            = fmc$file_organization =
              IF header^.attribute_present [fmc$file_organization] THEN
                NEXT static_label_item: [fmc$file_organization] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (23, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.file_organization := static_label_item^.source;
                cycle_attribute_values_rec.file_organization := static_label_item^.file_organization;
              IFEND;
            = fmc$file_processor =
              IF header^.attribute_present [fmc$file_processor] THEN
                NEXT static_label_item: [fmc$file_processor] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (24, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.file_processor := static_label_item^.source;
                get_name (cycle_attribute_values_rec.file_processor, status);
                IF NOT status.normal THEN
                  set_status_damaged_attributes (25, status);
                  RETURN;
                IFEND;
              IFEND;
            = fmc$file_structure =
              IF header^.attribute_present [fmc$file_structure] THEN
                NEXT static_label_item: [fmc$file_structure] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (26, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.file_contents := static_label_item^.source;
                get_name (static_file_structure, status);
                IF NOT status.normal THEN
                  set_status_damaged_attributes (27, status);
                  RETURN;
                IFEND;
              IFEND;
            = fmc$forced_write =
              IF header^.attribute_present [fmc$forced_write] THEN
                NEXT static_label_item: [fmc$forced_write] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (28, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.forced_write := static_label_item^.source;
                cycle_attribute_values_rec.forced_write := static_label_item^.forced_write;
              IFEND;
            = fmc$hashing_procedure_name =
              IF header^.attribute_present [fmc$hashing_procedure_name] THEN
                NEXT static_label_item: [fmc$hashing_procedure_name] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (29, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.hashing_procedure_name := static_label_item^.source;
                get_entry_point_reference (cycle_attribute_values_rec.hashing_procedure_name.entry_point,
                      cycle_attribute_values_rec.hashing_procedure_name.object_library, status);
                IF NOT status.normal THEN
                  set_status_damaged_attributes (30, status);
                  RETURN;
                IFEND;
              IFEND;
            = fmc$index_levels =
              IF header^.attribute_present [fmc$index_levels] THEN
                NEXT static_label_item: [fmc$index_levels] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (31, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.index_levels := static_label_item^.source;
                cycle_attribute_values_rec.index_levels := static_label_item^.integer_value;
              IFEND;
            = fmc$index_padding =
              IF header^.attribute_present [fmc$index_padding] THEN
                NEXT static_label_item: [fmc$index_padding] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (32, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.index_padding := static_label_item^.source;
                cycle_attribute_values_rec.index_padding := static_label_item^.index_padding;
              IFEND;
            = fmc$initial_home_block_count =
              IF header^.attribute_present [fmc$initial_home_block_count] THEN
                NEXT static_label_item: [fmc$initial_home_block_count] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (33, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.initial_home_block_count := static_label_item^.source;
                cycle_attribute_values_rec.initial_home_block_count := static_label_item^.integer_value;
              IFEND;
            = fmc$internal_code =
              IF header^.attribute_present [fmc$internal_code] THEN
                NEXT static_label_item: [fmc$internal_code] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (34, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.internal_code := static_label_item^.source;
                cycle_attribute_values_rec.internal_code := static_label_item^.internal_code;
              IFEND;
            = fmc$key_length =
              IF header^.attribute_present [fmc$key_length] THEN
                NEXT static_label_item: [fmc$key_length] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (35, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.key_length := static_label_item^.source;
                cycle_attribute_values_rec.key_length := static_label_item^.integer_value;
              IFEND;
            = fmc$key_position =
              IF header^.attribute_present [fmc$key_position] THEN
                NEXT static_label_item: [fmc$key_position] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (36, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.key_position := static_label_item^.source;
                cycle_attribute_values_rec.key_position := static_label_item^.integer_value;
              IFEND;
            = fmc$key_type =
              IF header^.attribute_present [fmc$key_type] THEN
                NEXT static_label_item: [fmc$key_type] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (37, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.key_type := static_label_item^.source;
                cycle_attribute_values_rec.key_type := static_label_item^.key_type;
              IFEND;
            = fmc$label_type =
              IF header^.attribute_present [fmc$label_type] THEN
                NEXT static_label_item: [fmc$label_type] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (38, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.file_label_type := static_label_item^.source;
                cycle_attribute_values_rec.file_label_type := static_label_item^.label_type;
              IFEND;
            = fmc$line_number =
              IF header^.attribute_present [fmc$line_number] THEN
                NEXT static_label_item: [fmc$line_number] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (39, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.line_number := static_label_item^.source;
                cycle_attribute_values_rec.line_number := static_label_item^.line_number;
              IFEND;
            = fmc$loading_factor =
              IF header^.attribute_present [fmc$loading_factor] THEN
                NEXT static_label_item: [fmc$loading_factor] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (40, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.loading_factor := static_label_item^.source;
                cycle_attribute_values_rec.loading_factor := static_label_item^.loading_factor;
              IFEND;
            = fmc$lock_expiration_time =
              IF header^.attribute_present [fmc$lock_expiration_time] THEN
                NEXT static_label_item: [fmc$lock_expiration_time] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (41, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.lock_expiration_time := static_label_item^.source;
                cycle_attribute_values_rec.lock_expiration_time := static_label_item^.integer_value;
              IFEND;
            = fmc$logging_options =
              IF header^.attribute_present [fmc$logging_options] THEN
                NEXT static_label_item: [fmc$logging_options] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (42, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.logging_options := static_label_item^.source;
                cycle_attribute_values_rec.logging_options := static_label_item^.logging_options;
              IFEND;
            = fmc$log_residence =
              IF header^.attribute_present [fmc$log_residence] THEN
                NEXT static_label_item: [fmc$log_residence] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (43, status);
                  RETURN;
                IFEND;
                NEXT str: [static_label_item^.path_length] IN static_label;
                IF str = NIL THEN
                  set_status_damaged_attributes (44, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.log_residence := static_label_item^.source;
                cycle_attribute_values_rec.log_residence := str^;
              IFEND;
            = fmc$max_block_length =
              IF header^.attribute_present [fmc$max_block_length] THEN
                NEXT static_label_item: [fmc$max_block_length] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (45, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.max_block_length := static_label_item^.source;
                cycle_attribute_values_rec.max_block_length := static_label_item^.integer_value;
              IFEND;
            = fmc$max_record_length =
              IF header^.attribute_present [fmc$max_record_length] THEN
                NEXT static_label_item: [fmc$max_record_length] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (46, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.max_record_length := static_label_item^.source;
                cycle_attribute_values_rec.max_record_length := static_label_item^.integer_value;
              IFEND;
            = fmc$min_block_length =
              IF header^.attribute_present [fmc$min_block_length] THEN
                NEXT static_label_item: [fmc$min_block_length] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (47, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.min_block_length := static_label_item^.source;
                cycle_attribute_values_rec.min_block_length := static_label_item^.integer_value;
              IFEND;
            = fmc$min_record_length =
              IF header^.attribute_present [fmc$min_record_length] THEN
                NEXT static_label_item: [fmc$min_record_length] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (48, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.min_record_length := static_label_item^.source;
                cycle_attribute_values_rec.min_record_length := static_label_item^.integer_value;
              IFEND;
            = fmc$padding_character =
              IF header^.attribute_present [fmc$padding_character] THEN
                NEXT static_label_item: [fmc$padding_character] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (49, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.padding_character := static_label_item^.source;
                cycle_attribute_values_rec.padding_character := static_label_item^.padding_character;
              IFEND;
            = fmc$page_format =
              IF header^.attribute_present [fmc$page_format] THEN
                NEXT static_label_item: [fmc$page_format] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (50, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.page_format := static_label_item^.source;
                cycle_attribute_values_rec.page_format := static_label_item^.page_format;
              IFEND;
            = fmc$page_length =
              IF header^.attribute_present [fmc$page_length] THEN
                NEXT static_label_item: [fmc$page_length] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (51, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.page_length := static_label_item^.source;
                cycle_attribute_values_rec.page_length := static_label_item^.integer_value;
              IFEND;
            = fmc$page_width =
              IF header^.attribute_present [fmc$page_width] THEN
                NEXT static_label_item: [fmc$page_width] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (52, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.page_width := static_label_item^.source;
                cycle_attribute_values_rec.page_width := static_label_item^.integer_value;
              IFEND;
            = fmc$preset_value =
              IF header^.attribute_present [fmc$preset_value] THEN
                NEXT static_label_item: [fmc$preset_value] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (53, status);
                  RETURN;
                IFEND;
                catalog_information_rec.cycle_registration.preset_value := static_label_item^.integer_value;
              IFEND;
            = fmc$record_delimiting_character =
              IF header^.attribute_present [fmc$record_delimiting_character] THEN
                NEXT static_label_item: [fmc$record_delimiting_character] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (54, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.record_delimiting_character := static_label_item^.source;
                cycle_attribute_values_rec.record_delimiting_character := static_label_item^.
                      record_delimiting_character;
              IFEND;
            = fmc$record_limit =
              IF header^.attribute_present [fmc$record_limit] THEN
                NEXT static_label_item: [fmc$record_limit] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (55, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.record_limit := static_label_item^.source;
                cycle_attribute_values_rec.record_limit := static_label_item^.integer_value;
              IFEND;
            = fmc$records_per_block =
              IF header^.attribute_present [fmc$records_per_block] THEN
                NEXT static_label_item: [fmc$records_per_block] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (56, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.records_per_block := static_label_item^.source;
                cycle_attribute_values_rec.records_per_block := static_label_item^.integer_value;
              IFEND;
            = fmc$record_type =
              IF header^.attribute_present [fmc$record_type] THEN
                NEXT static_label_item: [fmc$record_type] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (57, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.record_type := static_label_item^.source;
                cycle_attribute_values_rec.record_type := static_label_item^.record_type;
              IFEND;
            = fmc$ring_attributes =
              { processed above prior to FOR            loop }
              ;
            = fmc$statement_identifier =
              IF header^.attribute_present [fmc$statement_identifier] THEN
                NEXT static_label_item: [fmc$statement_identifier] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (58, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.statement_identifier := static_label_item^.source;
                cycle_attribute_values_rec.statement_identifier := static_label_item^.statement_identifier;
              IFEND;
            = fmc$user_info =
              IF header^.attribute_present [fmc$user_info] THEN
                NEXT static_label_item: [fmc$user_info] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (59, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.user_information := static_label_item^.source;
                IF static_label_item^.user_info_present THEN
                  NEXT str: [32] IN static_label;
                  IF str = NIL THEN
                    set_status_damaged_attributes (60, status);
                    RETURN;
                  IFEND;
                  cycle_attribute_values_rec.user_information := str^;
                IFEND;
              IFEND;
            = fmc$vertical_print_density =
              IF header^.attribute_present [fmc$vertical_print_density] THEN
                NEXT static_label_item: [fmc$vertical_print_density] IN static_label;
                IF static_label_item = NIL THEN
                  set_status_damaged_attributes (61, status);
                  RETURN;
                IFEND;
                cycle_attribute_sources_rec.vertical_print_density := static_label_item^.source;
                cycle_attribute_values_rec.vertical_print_density := static_label_item^.integer_value;
              IFEND;
            ELSE
            CASEND;
          FOREND;
          IF attribute_values_requested THEN
            fsp$convert_to_new_contents (static_file_contents, static_file_structure,
                  cycle_attribute_values_rec.file_contents, file_contents_truncated);
          IFEND;
        IFEND; {highest_attribute_present > 0}
      IFEND; {static_label_size <> 0}

      IF (oldest_target_file_instance^.device_class = rmc$terminal_device) AND attribute_values_requested AND
            ((cycle_attribute_sources_rec.page_length = amc$access_method_default) OR
            (cycle_attribute_sources_rec.page_width = amc$access_method_default)) THEN
        clp$check_name_for_path_handle (oldest_target_file_instance^.local_file_name, cl_path_handle);
        iip$get_page_length_width (cl_path_handle.regular_handle, terminal_attributes, status);
        IF cycle_attribute_sources_rec.page_length = amc$access_method_default THEN
          IF terminal_attributes [1].page_length = 0 THEN
            cycle_attribute_values_rec.page_length := UPPERVALUE (amt$page_length);
          ELSE
            cycle_attribute_values_rec.page_length := terminal_attributes [1].page_length;
          IFEND;
        IFEND;
        IF cycle_attribute_sources_rec.page_width = amc$access_method_default THEN
          IF terminal_attributes [2].page_width = 0 THEN
            cycle_attribute_values_rec.page_width := UPPERVALUE (amt$page_width);
          ELSE
            cycle_attribute_values_rec.page_width := terminal_attributes [2].page_width;
          IFEND;
        IFEND;
      IFEND; {terminal_device

      IF oldest_target_file_instance^.global_file_information^.device_dependent_info.device_class =
            rmc$magnetic_tape_device THEN
        tape_descriptor_sequence_ptr := oldest_target_file_instance^.global_file_information^.
              device_dependent_info.tape_descriptor;
        RESET tape_descriptor_sequence_ptr;
        NEXT tape_descriptor IN tape_descriptor_sequence_ptr;
        cycle_attribute_values_rec.block_type := tape_descriptor^.tape_attachment_information.block_type;
        cycle_attribute_values_rec.character_conversion := tape_descriptor^.tape_attachment_information.
              character_conversion;
        cycle_attribute_values_rec.internal_code := tape_descriptor^.tape_attachment_information.
              character_set;
        cycle_attribute_values_rec.max_block_length := tape_descriptor^.tape_attachment_information.
              max_block_length;
        cycle_attribute_values_rec.max_record_length := tape_descriptor^.tape_attachment_information.
              max_record_length;
        cycle_attribute_values_rec.padding_character := tape_descriptor^.tape_attachment_information.
              padding_character;
        cycle_attribute_values_rec.record_type := tape_descriptor^.tape_attachment_information.record_type;
      IFEND; {magnetic_tape_device

    IFEND; {catalog_info, file_attribute_values, file_attribute_sources}

    IF resolved_reference_requested THEN
      clp$check_name_for_path_handle (file_instance^.local_file_name, cl_path_handle);
      IF (file_instance^.instance_attributes.dynamic_label.open_position_source = amc$file_reference) OR
            (file_instance^.instance_attributes.dynamic_label.open_position_source = amc$open_request) THEN
         cl_path_handle.regular_handle.open_position.specified := TRUE;
         cl_path_handle.regular_handle.open_position.value := file_instance^.instance_attributes.
               dynamic_label.open_position;
      ELSE
         cl_path_handle.regular_handle.open_position.specified := FALSE;
      IFEND;
      PUSH p_evaluated_file_reference;
      p_evaluated_file_reference^ := fsv$evaluated_file_reference;
      p_evaluated_file_reference^.path_handle_info.path_handle := cl_path_handle.regular_handle;
      p_evaluated_file_reference^.path_handle_info.path_handle_present := TRUE;
      fmp$get_resolved_file_reference (p_evaluated_file_reference^, resolved_file_reference_rec, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
    IFEND;

    IF attachment_info_requested THEN
      attachment_information_seq := attachment_information;
      RESET attachment_information_seq;
      IF #SIZE (attachment_information_seq^) <= #SIZE (attachment_information_rec) THEN
        i#move (^attachment_information_rec, attachment_information_seq, #SIZE (attachment_information_seq^));
      ELSE
        set_status_bad_data_mapping ('attachment_information', status);
        RETURN;
      IFEND;
    IFEND;

    IF catalog_info_requested THEN
      catalog_information_seq := catalog_information;
      RESET catalog_information_seq;
      IF #SIZE (catalog_information_seq^) <= #SIZE (catalog_information_rec) THEN
        i#move (^catalog_information_rec, catalog_information_seq, #SIZE (catalog_information_seq^));
      ELSE
        set_status_bad_data_mapping ('catalog_information', status);
        RETURN;
      IFEND;
    IFEND;

    IF attribute_sources_requested THEN
      cycle_attribute_sources_seq := cycle_attribute_sources;
      RESET cycle_attribute_sources_seq;
      IF #SIZE (cycle_attribute_sources_seq^) <= #SIZE (cycle_attribute_sources_rec) THEN
        i#move (^cycle_attribute_sources_rec, cycle_attribute_sources_seq, #SIZE
              (cycle_attribute_sources_seq^));
      ELSE
        set_status_bad_data_mapping ('cycle_attribute_sources', status);
        RETURN;
      IFEND;
    IFEND;

    IF attribute_values_requested THEN
      cycle_attribute_values_seq := cycle_attribute_values;
      RESET cycle_attribute_values_seq;
      IF #SIZE (cycle_attribute_values_seq^) <= #SIZE (cycle_attribute_values_rec) THEN
        i#move (^cycle_attribute_values_rec, cycle_attribute_values_seq, #SIZE (cycle_attribute_values_seq^));
      ELSE
        set_status_bad_data_mapping ('cycle_attribute_values', status);
        RETURN;
      IFEND;
    IFEND;

    IF instance_info_requested THEN
      instance_information_seq := instance_information;
      RESET instance_information_seq;
      IF #SIZE (instance_information_seq^) <= #SIZE (instance_information_rec) THEN
        i#move (^instance_information_rec, instance_information_seq, #SIZE (instance_information_seq^));
      ELSE
        set_status_bad_data_mapping ('instance_information', status);
        RETURN;
      IFEND;
    IFEND;

    IF resolved_reference_requested THEN
      resolved_file_reference_seq := resolved_file_reference;
      RESET resolved_file_reference_seq;
      IF #SIZE (resolved_file_reference_seq^) <= #SIZE (resolved_file_reference_rec) THEN
        i#move (^resolved_file_reference_rec, resolved_file_reference_seq, #SIZE
              (resolved_file_reference_seq^));
      ELSE
 { commented out because of AAM referencing but not using.
 {      set_status_bad_data_mapping ('resolved_file_reference', status);
 {      RETURN;
      IFEND;
    IFEND;

    IF file_contents_truncated THEN
      amp$set_file_instance_abnormal (file_identifier, fse$file_contents_truncated,
          fsc$get_open_information_req,
          static_file_contents(1, clp$trimmed_string_size (static_file_contents)), status);
      osp$append_status_parameter (osc$status_parameter_delimiter,
          static_file_structure(1, clp$trimmed_string_size (static_file_structure)), status);
    IFEND;

  PROCEND fmp$get_open_information;
?? OLDTITLE ??

MODEND fmm$get_open_information;
