Helo Experts,
I have an issue in connecting to sybase from UNIX.
PFB, my code :
#!/bin/ksh
###############################################################################
#
# Filename: docflo_split.sh
#
# Description:docflo_split.sh WrapperScript splits the temporary file or files
# into different target files based on the LOBs passed
#
# Created By : Cognizant
# Created On : 2nd June, 2009
#
# Input Parameters : 1) Target Directory 2) Filename 3) Filename
# 4)Filename1 5)GRGR_ID
#--------------------
# Modification History
# --------------------
# +-----+--------------+-----------------+-----------------------------------+
# Mod Date Whom Comments
# +-----+--------------+-----------------+-----------------------------------+
# #1 21-May-2009 Cognizant Initial Version
###############################################################################
######################################################
# Input Parameters #
######################################################
TargetDir=$1
SourceDir=$2
filename=$3
filename1=$4
GRGR_ID=$5
sybServer=$6
sybUserID=$7
sybPassword=$8
sybDBName=$9
isqlDir=$10
###########################################################
# Initialization of log file format variables
###########################################################
star="**************************************"
shash="##"
hash="######################################"
###########################################################
# Initialization of control informations
###########################################################
ver="Version 1.0"
app_name="Docflo Process"
script_name=Docflo_split.sh
dtm=`date +'%Y%m%d%H%M'`
log=${SourceDir}/$GRGR_ID/Docflo_$dtm.log
btch_name="Docflo Process"
#######################################################
## Validate if the Necessary Parameters are passed #
#######################################################
if [ $# -ne 10 ]
then
echo $hash$hash > $log
echo $shash >> $log
echo $shash "Insufficient parameters" >> $log
echo $shash >> $log
echo $hash$hash >> $log
exit 1
fi
########################
# Display Header Message
########################
show_msg()
{
# Log file header details
echo $hash$hash >> $log
echo $shash >> $log
echo $shash "Application Name :" $app_name >> $log
echo $shash "Version :" $ver >> $log
echo $shash "Date :" `date` >> $log
echo $shash "Batch Name :" $btch_name >> $log
echo $shash "Output Log :" $log >> $log
echo $shash >> $log
echo $hash$hash >> $log
echo $shash >> $log
echo $shash >> $log
}
###################################################################
# Validate Available Space #
###################################################################
space_check()
{
used_space=`df -k $TargetDir |grep "%" |awk '{FS="%";print $1}' |awk '{FS=" ";print $NF}'`
unixFileDir=`echo "$TargetDir" |sed 's/temp/perm~/g'|awk '{FS="~";print $1}'`
space_limit=`cat "${unixFileDir}/UNIX_DISK_SPACE_CHECK.txt" |head -1 |awk '{FS="=";print $2}'`
if [ $used_space -gt $space_limit ] ; then
msg="Disk Space Availability Check"
disp_msg
df -k $TargetDir |tee -a $log
echo $hash$hash |tee -a $log
echo "Unix Directory Used Percentage :$used_space%" |tee -a $log
echo "Unix Directory Usage Limit :$space_limit%" |tee -a $log
echo "Usage Exceeds the Specified Limit, Process Aborted. Clear Space and Continue." |tee -a $log
echo $hash$hash |tee -a $log
exit 1
fi
}
###################################################################
# Display Message #
###################################################################
disp_msg()
{
#process execution notes
echo $hash$hash >> $log
echo $shash >> $log
echo $shash "$msg" >> $log
echo $shash "----------------------------">> $log
echo $shash >> $log
}
#######################################################################
########################
# Display Start Message
########################
show_start()
{
# Initialization of step level informations
start_dtm=`date +"%m/%d/%C%y%t%H:%M:%S%t%p"`
step_msg="$script_name Step - Start"
echo $shash$star$star >> $log
echo $shash $step_msg >> $log
echo $shash Start Time : $start_dtm >> $log
echo $shash$star$star >> $log
echo $shash >> $log
echo $shash >> $log
}
########################
# Validating the directory structure
########################
validate()
{
if [ ! -d $SourceDir ]
then
echo "Unix path supplied is not a valid directory." >> $log
disp_emsg
exit 1;
fi
if [ ! -d $TargetDir ]
then
echo "Unix path supplied is not a valid directory." >> $log
disp_emsg
exit 1;
fi
}
###########################
# Remove intermediate files
###########################
rem_files()
{
echo $hash$hash >> $log
echo $shash >> $log
rm ${SourceDir}/$GRGR_ID/$filename
echo $shash "The intermediate files $filename in Unix directory $SourceDir are deleted " >> $log
rm ${SourceDir}/$GRGR_ID/$filename1
echo $shash "The intermediate files $filename1 in Unix directory $SourceDir are deleted " >> $log
echo $shash >> $log
echo $hash$hash >> $log
}
#####################
# Display End Message
#####################
disp_emsg()
{
#process execution end notes
end_dtm=`date +"%m/%d/%C%y%t%H:%M:%S%t%p"`
step_msg="$script_name Step - End"
echo $shash$star$star >> $log
echo $shash $step_msg >> $log
echo $shash End Time : $end_dtm >> $log
echo $shash$star$star >> $log
}
###########################################################
# Initialization of process level informations #
###########################################################
show_msg
space_check
show_start
validate
#######################################################
# Checking the existance of tempFile #
#######################################################
test -f $SourceDir/$GRGR_ID/$filename
lnRetCd=$?
if [ $lnRetCd -ne 0 ]
then
echo "ERROR MESSAGE $filename is not available" >> $log
disp_emsg
exit 1;
fi
test -f $SourceDir/$GRGR_ID/$filename1
lnRetCd=$?
if [ $lnRetCd -ne 0 ]
then
echo "ERROR MESSAGE $filename1 is not available" >> $log
disp_emsg
exit 1;
fi
#######################################################
# Splitting the File #
#######################################################
juliandate=`date +%j`
sqlstatus=`$isqlDir -S$sybServer -U$sybUserID -P$sybPassword -D$sybDBName -w 200 << EOF > ${SourceDir}/docflow_temp.txt
SET NOCOUNT ON
EXEC EXTSP_UNIX_PARM_SEL '$GRGR_ID','CLCL_DOFL'
go
EOF`
isqlstatus=$?
if [ $isqlstatus -ne 0 ] ;then
echo $hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash >> $log
echo SYBASE: Failed to Connect to Sybase >> $log
echo $hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash >> $log
exit 1
fi
Am receving the following error :
Output from command ====>
/DataStage75/facetsconv/scripts/REG2/FACETS/MacessDocFloSeq_REG2_new/2700/docflo_split.sh[234]:\
/DataStage75/facetsconv/temp/REG2/FACETS/MacessDocFloSeq_REG2_new/output0: not found.
I am not sure why 0 is added to the path, thats why the path is unfound.
---------- Post updated at 06:29 AM ---------- Previous update was at 06:24 AM ----------
This is the exact portion of the code where the error is thrown:
sqlstatus=`$isqlDir -S$sybServer -U$sybUserID -P$sybPassword -D$sybDBName -w 200 << EOF > ${SourceDir}/docflow_temp.txt
SET NOCOUNT ON
EXEC EXTSP_UNIX_PARM_SEL '$GRGR_ID','CLCL_DOFL'
go
EOF`
isqlstatus=$?
if [ $isqlstatus -ne 0 ] ;then
echo $hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash >> $log
echo SYBASE: Failed to Connect to Sybase >> $log
echo $hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash$hash >> $log
exit 1
fi