#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/events/utils/snaversion.sh 1.5 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 1998,2007 
# 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 
# @(#)44	1.5 src/43haes/usr/sbin/cluster/events/utils/snaversion.sh, hacmp.hawan, 61haes_r714 3/26/07 17:52:30
###############################################################################
#
#  Name:  snaversion
#	This utility is used to set a boolean indicating the level of 
#	installed IBM Communications Server (SNA Server)
#
# Arguments:   None 
#
# Returns:      0 - SNA version 5 Not installed
#               1 - SNA version 5 installed
#		2 - SNA not installed 
#
###############################################################################
PROGNAME="$0"

###############################################################################
#
# Name: snaver
#
#       Determine the version level of the installed Communications Server.
#
#
# Returns: 0 success
#	   1 failure
###############################################################################
snaver()
{
	typeset PS4_FUNC="snaver"

	# first check to see if sna is installed.
	SNA5=$(lslpp -lqc sna.rte 2> /dev/null )
	if [ $? -ne 0 ]
	then
	    echo 2
	    return 2
	fi
	    
	# now get the version.
	SNA5=$(echo $SNA5 | cut -d':' -f3 | cut -d'.' -f1 | sort -u)
	if [ $SNA5 -ge 5 ]
	then
	    echo 1
	    return 1
	fi

	echo 0
	return 0
}
###############################################################################

#Determine SNA version
ISSNA5=$(snaver)

echo $ISSNA5
