MODULE bam$validate_compatibility;
?? RIGHT := 110 ??

{ PURPOSE:
{    This module validates upward and downward compatibility of the
{ file label between different systems.
{
{        BAP$VALIDATE_COMPATIBILITY (P_FILE_LABEL, P_FILE_LABEL_HEADER,
{              LOCAL_FILE_NAME, STATUS)
{
{ P_FILE_LABEL: (input) This parameter specifies the file label to be
{        validated.
{
{ P_FILE_LABEL_HEADER: (input) This parameter specifies the header in
{        the file label.
{
{ LOCAL_FILE_NAME: (input) This parameter specifies the local name of the
{        file whose label is to be validated.
{
{ STATUS: (output) This parameter returns the request status.
{

?? NEWTITLE := '    Global Declarations Referenced By This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc oss$job_paged_literal
*copyc oss$task_private
*copyc fmc$current_revision_level
*copyc fmc$unique_label_id
*copyc ame$attribute_validation_errors
*copyc ame$lfn_program_actions
*copyc amt$file_reference
*copyc amt$local_file_name
*copyc amt$logging_options
*copyc amt$path_name
*copyc clt$file
*copyc fmt$file_attribute_keys
*copyc fmt$file_label
*copyc fmt$static_label_header
*copyc fmt$static_label_item
*copyc ost$name
*copyc pmt$program_name
?? POP ??
*copyc clp$construct_path_handle_name
*copyc clp$convert_string_to_file_ref
*copyc clp$validate_name
*copyc osp$append_status_integer
*copyc osp$append_status_parameter
*copyc osp$set_status_abnormal
?? OLDTITLE ??
?? NEWTITLE := '[XDCL] bap$validate_compatibility', EJECT ??

  PROCEDURE [XDCL] bap$validate_compatibility
    (    file_label_p: fmt$p_file_label;
         p_file_label_header: ^fmt$static_label_header;
         path_handle: fmt$path_handle;
         checksum_present: boolean;
     VAR status: ost$status);

    TYPE
      attribute_keys = set of fmt$file_attribute_keys;

    VAR
      attributes_are_compatible: boolean,
      entry_point_refs: [STATIC, READ, oss$job_paged_literal] attribute_keys :=
            $attribute_keys [fmc$compression_procedure_name, fmc$hashing_procedure_name,
            fmc$file_access_procedure, fmc$collate_table_name],
      i: integer,
      job_label: ^SEQ ( * ),
      names: [STATIC, READ, oss$job_paged_literal] attribute_keys := $attribute_keys
            [fmc$file_contents, fmc$file_processor, fmc$file_structure],
      p_file_label: fmt$p_file_label,
      static_label_item: ^fmt$static_label_item,
      str: ^string ( * ),
      text: string (50),
      text_length: integer,
      user_attributes: ^SEQ ( * ),
      x: ^cell;

?? NEWTITLE := '[XDCL] bap$validate_compatibility', EJECT ??

    PROCEDURE set_status_abnormal
      (    level: fmt$revision_level;
           text: string ( * );
       VAR status: ost$status);

      VAR
        path_handle_name: fst$path_handle_name;

      clp$construct_path_handle_name (path_handle, path_handle_name);
      osp$set_status_abnormal (amc$access_method_id, ame$incompatible_attributes, path_handle_name, status);
      osp$append_status_integer (osc$status_parameter_delimiter, level, 10, FALSE, status);
      osp$append_status_parameter (osc$status_parameter_delimiter, text, status);

    PROCEND set_status_abnormal;
?? OLDTITLE ??
?? EJECT ??
    p_file_label := file_label_p; {make a local copy of sequence pointer}

    IF p_file_label_header^.revision_level > fmc$current_revision_level THEN
      { validate downward compatibility }

      FOR i := fmc$average_record_length TO fmc$highest_current_attribute DO
        IF p_file_label_header^.attribute_present [i] THEN
          NEXT static_label_item: [i] IN p_file_label;
          IF static_label_item = NIL THEN
            STRINGREP (text, text_length, 'downward (attribute ordinal ', i: 2, ')');
            set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
            RETURN; {----->
          IFEND;

          IF i IN entry_point_refs THEN
            NEXT str: [static_label_item^.entry_point_name_length] IN p_file_label;
            IF str = NIL THEN
              STRINGREP (text, text_length, 'downward (attribute ordinal ', i: 2, ')');
              set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
              RETURN; {----->
            IFEND;
            IF static_label_item^.entry_point_path_length > 0 THEN
              NEXT str: [static_label_item^.entry_point_path_length] IN p_file_label;
              IF str = NIL THEN
                STRINGREP (text, text_length, 'downward (attribute ordinal ', i: 2, ')');
                set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
                RETURN; {----->
              IFEND;
            IFEND;
          IFEND;

          IF i IN names THEN
            NEXT str: [static_label_item^.name_length] IN p_file_label;
            IF str = NIL THEN
              STRINGREP (text, text_length, 'downward (attribute ordinal ', i: 2, ')');
              set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
              RETURN; {----->
            IFEND;
          IFEND;

          IF i = fmc$log_residence THEN
            NEXT str: [static_label_item^.path_length] IN p_file_label;
            IF str = NIL THEN
              STRINGREP (text, text_length, 'downward (attribute ordinal ', i: 2, ')');
              set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
              RETURN; {----->
            IFEND;
          IFEND;

          IF i = fmc$user_info THEN
            NEXT str: [32] IN p_file_label;
            IF str = NIL THEN
              STRINGREP (text, text_length, 'downward (attribute ordinal ', i: 2, ')');
              set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
              RETURN; {----->
            IFEND;
          IFEND;

        IFEND;
      FOREND;
      FOR i := fmc$highest_current_attribute + 1 TO p_file_label_header^.highest_attribute_supported DO
        IF p_file_label_header^.attribute_present [i] THEN
          STRINGREP (text, text_length, 'downward (attribute ordinal ', i: 2, ')');
          set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
          RETURN; {----->
        IFEND;
      FOREND;

      IF p_file_label_header^.user_attribute_length > 0 THEN
        NEXT user_attributes: [[REP p_file_label_header^.user_attribute_length OF cell]] IN p_file_label;
        IF user_attributes = NIL THEN
          osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                'user_attributes NIL on downward validation in bap$validate_compatibility', status);
          RETURN; {----->
        IFEND;
      IFEND;
      IF p_file_label_header^.job_routing_label_size > 0 THEN
        NEXT job_label: [[REP p_file_label_header^.job_routing_label_size OF cell]] IN p_file_label;
        IF job_label = NIL THEN
          osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                'job_label NIL on downward validation in bap$validate_compatibility', status);
          RETURN; {----->
        IFEND;
      IFEND;
      NEXT x IN p_file_label;
      IF x <> NIL THEN
        set_status_abnormal (p_file_label_header^.revision_level, 'downward (x)', status);
        RETURN; {----->
      IFEND;
      bap$validate_attributes (p_file_label, checksum_present, attributes_are_compatible, status);
      IF NOT attributes_are_compatible THEN
        STRINGREP (text, text_length, 'downward (attribute validation ordinal)');
        set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
      IFEND;

    ELSEIF p_file_label_header^.revision_level < fmc$current_revision_level THEN
      { validate upward compatibility }

      FOR i := fmc$average_record_length TO p_file_label_header^.highest_attribute_supported DO
        IF p_file_label_header^.attribute_present [i] THEN
          NEXT static_label_item: [i] IN p_file_label;
          IF static_label_item = NIL THEN
            STRINGREP (text, text_length, 'upward (attribute ordinal ', i: 2, ')');
            set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
            RETURN; {----->
          IFEND;

          IF i IN entry_point_refs THEN
            NEXT str: [static_label_item^.entry_point_name_length] IN p_file_label;
            IF str = NIL THEN
              STRINGREP (text, text_length, 'upward (attribute ordinal ', i: 2, ')');
              set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
              RETURN; {----->
            IFEND;
            IF static_label_item^.entry_point_path_length > 0 THEN
              NEXT str: [static_label_item^.entry_point_path_length] IN p_file_label;
              IF str = NIL THEN
                STRINGREP (text, text_length, 'upward (attribute ordinal ', i: 2, ')');
                set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
                RETURN; {----->
              IFEND;
            IFEND;
          IFEND;

          IF i IN names THEN
            NEXT str: [static_label_item^.name_length] IN p_file_label;
            IF str = NIL THEN
              STRINGREP (text, text_length, 'upward (attribute ordinal ', i: 2, ')');
              set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
              RETURN; {----->
            IFEND;
          IFEND;

          IF i = fmc$log_residence THEN
            NEXT str: [static_label_item^.path_length] IN p_file_label;
            IF str = NIL THEN
              STRINGREP (text, text_length, 'upward (attribute ordinal ', i: 2, ')');
              set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
              RETURN; {----->
            IFEND;
          IFEND;

          IF i = fmc$user_info THEN
            NEXT str: [32] IN p_file_label;
            IF str = NIL THEN
              STRINGREP (text, text_length, 'upward (attribute ordinal ', i: 2, ')');
              set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
              RETURN; {----->
            IFEND;
          IFEND;

        IFEND;
      FOREND;
      FOR i := p_file_label_header^.highest_attribute_supported + 1 TO fmc$highest_current_attribute DO
        IF p_file_label_header^.attribute_present [i] THEN
          STRINGREP (text, text_length, 'upward (attribute ordinal ', i: 2, ')');
          set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
          RETURN; {----->
        IFEND;
      FOREND;

      IF p_file_label_header^.user_attribute_length > 0 THEN
        NEXT user_attributes: [[REP p_file_label_header^.user_attribute_length OF cell]] IN p_file_label;
        IF user_attributes = NIL THEN
          osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                'user_attributes NIL on upward validation in bap$validate_compatibility', status);
          RETURN; {----->
        IFEND;
      IFEND;
      IF p_file_label_header^.job_routing_label_size > 0 THEN
        NEXT job_label: [[REP p_file_label_header^.job_routing_label_size OF cell]] IN p_file_label;
        IF job_label = NIL THEN
          osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                'job_label NIL on upward validation in bap$validate_compatibility', status);
          RETURN; {----->
        IFEND;
      IFEND;
      NEXT x IN p_file_label;
      IF x <> NIL THEN
        set_status_abnormal (p_file_label_header^.revision_level, 'upward (x)', status);
        RETURN; {----->
      IFEND;
      bap$validate_attributes (p_file_label, checksum_present, attributes_are_compatible, status);
      IF NOT attributes_are_compatible THEN
        STRINGREP (text, text_length, 'upward (attribute validation ordinal)');
        set_status_abnormal (p_file_label_header^.revision_level, text (1, text_length), status);
      IFEND;
    IFEND;

  PROCEND bap$validate_compatibility;
?? OLDTITLE ??
?? NEWTITLE := '[XDCL] bap$validate_attributes', EJECT ??

  PROCEDURE [XDCL] bap$validate_attributes
    (    p_static_label: ^SEQ ( * );
         checksum_present: boolean;
     VAR attributes_are_compatible: boolean;
     VAR status: ost$status);


    VAR
      amv$logging_options: [STATIC, READ, oss$job_paged_literal] amt$logging_options :=
            [amc$enable_parcels, amc$enable_media_recovery, amc$enable_request_recovery],
      checksum: ^integer,
      header: ^fmt$static_label_header,
      attribute_key: fmt$file_attribute_keys,
      static_label: ^SEQ ( * ),
      static_label_item: ^fmt$static_label_item,
      collate_table_name: pmt$program_name,
      compression_procedure_name: pmt$program_name,
      compression_procedure_path: amt$path_name,
      hashing_procedure_name: pmt$program_name,
      hashing_procedure_path: amt$path_name,
      fap_name: pmt$program_name,
      file_contents,
      file_processor,
      file_structure: pmt$program_name,
      validated_name: ost$name,
      ignore_file: fst$parsed_file_reference,
      ignore_path: amt$path_name,
      ignore_found: boolean,
      str: ^string ( * );

?? NEWTITLE := '[inline] GET_ENTRY_POINT_REFERENCE', EJECT ??

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

      NEXT str: [static_label_item^.entry_point_name_length] IN static_label;
      IF str = NIL THEN
        osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
              'str NIL in bap$validate_attributes for entry_point_name', 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
          osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                'str NIL in bap$validate_attributes for entry_point_path', status);
          RETURN; {----->
        IFEND;
        path := str^;
      IFEND;

    PROCEND get_entry_point_reference;
?? OLDTITLE ??
?? NEWTITLE := '[inline] GET_NAME', EJECT ??

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

      NEXT str: [static_label_item^.name_length] IN static_label;
      IF str = NIL THEN
        osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
              'get_name str NIL in bap$validate_attributes', status);
        RETURN; {----->
      IFEND;
      name := str^;
    PROCEND get_name;
?? OLDTITLE ??
?? EJECT ??

    status.normal := TRUE;
    attributes_are_compatible := TRUE;

    static_label := p_static_label; {assign seq pointer to local variable}

    IF static_label <> NIL THEN
      RESET static_label;
      IF checksum_present THEN
        NEXT checksum IN static_label;
        IF checksum = NIL THEN
          osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                'BAD LABEL DETECTED in bap$validate_attributes', status);
          RETURN; {----->
        IFEND;
      IFEND;
      NEXT header IN static_label;
      IF (header = NIL) OR (header^.unique_character <> fmc$unique_label_id) THEN
        osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
              'INVALID STATIC LABEL DETECTED in bap$validate_attributes', status);
        RETURN; {----->
      IFEND;
      IF header^.file_previously_opened THEN
        IF NOT ((1 <= header^.ring_attributes.r1) AND (header^.ring_attributes.r1 <=
              header^.ring_attributes.r2) AND (header^.ring_attributes.r2 <= header^.ring_attributes.r3) AND
              (header^.ring_attributes.r3 <= 13)) THEN
          attributes_are_compatible := FALSE;
        IFEND;
      IFEND;
      IF header^.highest_attribute_present > 0 THEN
        attribute_key := fmc$average_record_length;
        WHILE (attribute_key <= header^.highest_attribute_present) AND (attributes_are_compatible) DO
          IF header^.attribute_present [attribute_key] THEN
            CASE attribute_key OF
            = fmc$block_type =
              NEXT static_label_item: [fmc$block_type] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'block_type NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.block_type < LOWERVALUE (amt$block_type)) OR
                    (static_label_item^.block_type > UPPERVALUE (amt$block_type)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$character_conversion =
              NEXT static_label_item: [fmc$character_conversion] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'character_conversion NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.character_conversion < LOWERVALUE (boolean)) OR
                    (static_label_item^.character_conversion > UPPERVALUE (boolean)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$clear_space =
              NEXT static_label_item: [fmc$clear_space] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'clear_space NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.clear_space < LOWERVALUE (ost$clear_file_space)) OR
                    (static_label_item^.clear_space > UPPERVALUE (ost$clear_file_space)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$file_access_procedure =
              NEXT static_label_item: [fmc$file_access_procedure] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'file_access_procedure NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              get_entry_point_reference (fap_name, ignore_path);
              clp$validate_name (fap_name, validated_name, attributes_are_compatible);
            = fmc$file_contents =
              NEXT static_label_item: [fmc$file_contents] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'file_contents NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              get_name (file_contents);
              clp$validate_name (file_contents, validated_name, attributes_are_compatible);
            = fmc$file_limit =
              NEXT static_label_item: [fmc$file_limit] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'file_limit NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$file_limit)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$file_limit)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$file_organization =
              NEXT static_label_item: [fmc$file_organization] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'file_organization NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.file_organization < LOWERVALUE (amt$file_organization)) OR
                    (static_label_item^.file_organization > UPPERVALUE (amt$file_organization)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$file_processor =
              NEXT static_label_item: [fmc$file_processor] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'file_processor NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              get_name (file_processor);
              clp$validate_name (file_processor, validated_name, attributes_are_compatible);
            = fmc$file_structure =
              NEXT static_label_item: [fmc$file_structure] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'file_structure NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              get_name (file_structure);
              clp$validate_name (file_structure, validated_name, attributes_are_compatible);
            = fmc$forced_write =
              NEXT static_label_item: [fmc$forced_write] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'forced_write NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.forced_write < LOWERVALUE (amt$forced_write)) OR
                    (static_label_item^.forced_write > UPPERVALUE (amt$forced_write)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$internal_code =
              NEXT static_label_item: [fmc$internal_code] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'internal_code NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.internal_code < LOWERVALUE (amt$internal_code)) OR
                    (static_label_item^.internal_code > UPPERVALUE (amt$internal_code)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$label_type =
              NEXT static_label_item: [fmc$label_type] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'label_type NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.label_type < LOWERVALUE (amt$label_type)) OR
                    (static_label_item^.label_type > UPPERVALUE (amt$label_type)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$line_number =
              NEXT static_label_item: [fmc$line_number] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'line_number NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.line_number.length < LOWERVALUE (amt$line_number_length)) OR
                    (static_label_item^.line_number.length > UPPERVALUE (amt$line_number_length)) OR
                    (static_label_item^.line_number.location < LOWERVALUE (amt$line_number_location)) OR
                    (static_label_item^.line_number.location > UPPERVALUE (amt$line_number_location)) THEN
                IF (static_label_item^.source = amc$undefined_attribute) THEN
                  { Old default value; must be changed later.
                  { A change here will cause a change to pf label without
                  { a corresponding checksum change.
                ELSE
                  attributes_are_compatible := FALSE;
                IFEND;
              IFEND;
            = fmc$max_block_length =
              NEXT static_label_item: [fmc$max_block_length] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'max_block_length NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$max_block_length)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$max_block_length)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$max_record_length =
              NEXT static_label_item: [fmc$max_record_length] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'max_record_length NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$max_record_length)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$max_record_length)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$min_block_length =
              NEXT static_label_item: [fmc$min_block_length] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'min_block_length NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$min_block_length)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$min_block_length)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$min_record_length =
              NEXT static_label_item: [fmc$min_record_length] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'min_record_length NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$min_record_length)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$min_record_length)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$padding_character =
              NEXT static_label_item: [fmc$padding_character] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'padding_character NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.padding_character < LOWERVALUE (static_label_item^.padding_character)) OR
                    (static_label_item^.padding_character > UPPERVALUE (static_label_item^.padding_character))
                    THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$page_format =
              NEXT static_label_item: [fmc$page_format] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'page_format NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.page_format < LOWERVALUE (amt$page_format)) OR
                    (static_label_item^.page_format > UPPERVALUE (amt$page_format)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$page_length =
              NEXT static_label_item: [fmc$page_length] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'page_length NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$page_length)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$page_length)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$page_width =
              NEXT static_label_item: [fmc$page_width] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'page_width NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$page_width)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$page_width)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$preset_value =
              NEXT static_label_item: [fmc$preset_value] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'preset_value NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$preset_value)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$preset_value)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$record_delimiting_character =
              NEXT static_label_item: [fmc$record_delimiting_character] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'record_delimiting_character NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
            = fmc$record_type =
              NEXT static_label_item: [fmc$record_type] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'record_type NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.record_type < LOWERVALUE (amt$record_type)) OR
                    (static_label_item^.record_type > UPPERVALUE (amt$record_type)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$statement_identifier =
              NEXT static_label_item: [fmc$statement_identifier] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'statement_identifier NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF ((static_label_item^.statement_identifier.length < LOWERVALUE (amt$statement_id_length)) OR
                    (static_label_item^.statement_identifier.length > UPPERVALUE (amt$statement_id_length)) OR
                    (static_label_item^.statement_identifier.location <
                    LOWERVALUE (amt$statement_id_location)) OR (static_label_item^.statement_identifier.
                    location > UPPERVALUE (amt$statement_id_location))) THEN
                IF (static_label_item^.source = amc$undefined_attribute) THEN
                  { Old default value; must be changed later.
                  { A change here will cause a change to pf label without
                  { a corresponding checksum change.
                ELSE
                  attributes_are_compatible := FALSE;
                IFEND;
              IFEND;
            = fmc$user_info =
              NEXT static_label_item: [fmc$user_info] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'user_info NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF static_label_item^.user_info_present THEN
                NEXT str: [32] IN static_label;
              IFEND;
            = fmc$vertical_print_density =
              NEXT static_label_item: [fmc$vertical_print_density] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'vertical_print_density NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$vertical_print_density)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$vertical_print_density)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$average_record_length =
              NEXT static_label_item: [fmc$average_record_length] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'average_record_length NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$average_record_length)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$average_record_length)) THEN
                IF static_label_item^.source <> amc$undefined_attribute THEN
                  attributes_are_compatible := FALSE;
                IFEND;
              IFEND;
            = fmc$collate_table =
              NEXT static_label_item: [fmc$collate_table] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'collate_table NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
            = fmc$collate_table_name =
              NEXT static_label_item: [fmc$collate_table_name] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'collate_table_name NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              get_entry_point_reference (collate_table_name, ignore_path);
              IF collate_table_name <> osc$null_name THEN
                clp$validate_name (collate_table_name, validated_name, attributes_are_compatible);
              IFEND;
            = fmc$compression_procedure_name =
              NEXT static_label_item: [fmc$compression_procedure_name] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'compression_procedure_name NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              get_entry_point_reference (compression_procedure_name, compression_procedure_path);
              IF compression_procedure_name <> osc$null_name THEN
                clp$validate_name (compression_procedure_name, validated_name, attributes_are_compatible);
                IF compression_procedure_path <> osc$null_name THEN
                  clp$convert_string_to_file_ref (compression_procedure_path, ignore_file, status);
                  IF NOT status.normal THEN
                    attributes_are_compatible := FALSE;
                  IFEND;
                IFEND;
              IFEND;
            = fmc$data_padding =
              NEXT static_label_item: [fmc$data_padding] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'data_padding NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.data_padding < LOWERVALUE (amt$data_padding)) OR
                    (static_label_item^.data_padding > UPPERVALUE (amt$data_padding)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$dynamic_home_block_space =
              NEXT static_label_item: [fmc$dynamic_home_block_space] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'dynamic_home_block_space NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.dynamic_home_block_space < LOWERVALUE (boolean)) OR
                    (static_label_item^.dynamic_home_block_space > UPPERVALUE (boolean)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$embedded_key =
              NEXT static_label_item: [fmc$embedded_key] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'embedded_key NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.embedded_key < LOWERVALUE (boolean)) OR
                    (static_label_item^.embedded_key > UPPERVALUE (boolean)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$estimated_record_count =
              NEXT static_label_item: [fmc$estimated_record_count] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'estimated_record_count NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$estimated_record_count)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$estimated_record_count)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$hashing_procedure_name =
              NEXT static_label_item: [fmc$hashing_procedure_name] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'hashing_procedure_name NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              get_entry_point_reference (hashing_procedure_name, hashing_procedure_path);
              IF hashing_procedure_name <> osc$null_name THEN
                clp$validate_name (hashing_procedure_name, validated_name, attributes_are_compatible);
                IF hashing_procedure_path <> osc$null_name THEN
                  clp$convert_string_to_file_ref (hashing_procedure_path, ignore_file, status);
                  IF NOT status.normal THEN
                    attributes_are_compatible := FALSE;
                  IFEND;
                IFEND;
              IFEND;
            = fmc$index_levels =
              NEXT static_label_item: [fmc$index_levels] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'index_levels NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$index_levels)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$index_levels)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$index_padding =
              NEXT static_label_item: [fmc$index_padding] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'index_padding NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.index_padding < LOWERVALUE (amt$index_padding)) OR
                    (static_label_item^.index_padding > UPPERVALUE (amt$index_padding)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$initial_home_block_count =
              NEXT static_label_item: [fmc$initial_home_block_count] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'initial_home_block_count NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$initial_home_block_count)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$initial_home_block_count)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$key_length =
              NEXT static_label_item: [fmc$key_length] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'key_length NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$key_length)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$key_length)) THEN
                IF static_label_item^.source <> amc$undefined_attribute THEN
                  attributes_are_compatible := FALSE;
                IFEND;
              IFEND;
            = fmc$key_position =
              NEXT static_label_item: [fmc$key_position] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'key_position NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$key_position)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$key_position)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$key_type =
              NEXT static_label_item: [fmc$key_type] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'key_type NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.key_type < LOWERVALUE (amt$key_type)) OR
                    (static_label_item^.key_type > UPPERVALUE (amt$key_type)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$loading_factor =
              NEXT static_label_item: [fmc$loading_factor] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'loading_factor NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.loading_factor < LOWERVALUE (amt$loading_factor)) OR
                    (static_label_item^.loading_factor > UPPERVALUE (amt$loading_factor)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$lock_expiration_time =
              NEXT static_label_item: [fmc$lock_expiration_time] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'lock_expiration_time NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$lock_expiration_time)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$lock_expiration_time)) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$logging_options =
              NEXT static_label_item: [fmc$logging_options] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'logging_options NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF NOT (static_label_item^.logging_options <= amv$logging_options) THEN
                attributes_are_compatible := FALSE;
              IFEND;
            = fmc$log_residence =
              NEXT static_label_item: [fmc$log_residence] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'log_residence NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              NEXT str: [static_label_item^.path_length] IN static_label;
              IF str = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'log_residence str NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF str^ <> osc$null_name THEN
                clp$convert_string_to_file_ref (str^, ignore_file, status);
                IF NOT status.normal THEN
                  attributes_are_compatible := FALSE;
                IFEND;
              IFEND;
            = fmc$record_limit =
              NEXT static_label_item: [fmc$record_limit] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'record_limit NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$record_limit)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$record_limit)) THEN
                IF static_label_item^.source <> amc$undefined_attribute THEN
                  attributes_are_compatible := FALSE;
                IFEND;
              IFEND;
            = fmc$records_per_block =
              NEXT static_label_item: [fmc$records_per_block] IN static_label;
              IF static_label_item = NIL THEN
                osp$set_status_abnormal (amc$access_method_id, ame$damaged_file_attributes,
                      'records_per_block NIL in bap$validate_attributes', status);
                RETURN; {----->
              IFEND;
              IF (static_label_item^.integer_value < LOWERVALUE (amt$records_per_block)) OR
                    (static_label_item^.integer_value > UPPERVALUE (amt$records_per_block)) THEN
                IF static_label_item^.source <> amc$undefined_attribute THEN
                  attributes_are_compatible := FALSE;
                IFEND;
              IFEND;
            ELSE
              attributes_are_compatible := FALSE;
            CASEND;
          IFEND;
          attribute_key := attribute_key + 1;
        WHILEND;
      IFEND;
    IFEND;

  PROCEND bap$validate_attributes;
?? OLDTITLE ??
MODEND bam$validate_compatibility;

