#!/bin/ksh93
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/lib/ksh93/aix/odm/KLIB_AIX_ODM_fields_differ.sh 1.4 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2005,2011 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)70	1.4 src/43haes/lib/ksh93/aix/odm/KLIB_AIX_ODM_fields_differ.sh, hacmp, 61haes_r714 11/28/11 15:13:43
#
#=head1 NAME
#
# KLIB_AIX_ODM_fields_differ - Compare two ODMs field by field and
#                              report the fields that are different
#                              to the third list argument
#
#=head1 SYNOPSIS
#
# typeset different_fields
# KLIB_AIX_ODM_fields_differ "HACMPcluster" "/etc/es/objrepos" \
#		     "/usr/es/sbin/cluster/hacmp/etc/objrepos/" different_fields
# echo $different_fields 
#
#=head1 DESCRIPTION
#
# For the specified class, the ODM is compared between two
# separate directories
#
#=head1 ARGUMENTS
#
#	1: [scalar] ODM class name
# 	2: [scalar] first odm directory to obtain the first copy of the ODM
#	3: [scalar] second odm directory to load the second copy
#   4: [by ref] list variable to add the differing fields to
#
#=head1 RETURN
#
#   0: success
#   1: failed
#
#=head1 COPYRIGHT
#
#(C) COPYRIGHT International Business Machines Corp. 2005
#All Rights Reserved
#
#=cut
#
function KLIB_AIX_ODM_fields_differ
{
  . /usr/es/lib/ksh93/func_include

  typeset -n list=$4
  list=''
  typeset -A ar1 ar2
  typeset strip_quotes=true

  ODMDIR=$2 odmget $1 |
    KLIB_UTIL_LIST_array_load_by_token ar1 $strip_quotes "$IFS" '$1' '$3'

  ODMDIR=$3 odmget $1 |
    KLIB_UTIL_LIST_array_load_by_token ar2 $strip_quotes "$IFS" '$1' '$3'

  KLIB_UTIL_LIST_array_fields_differ ar1 ar2 list
}
