Error in Sybase connectivity via UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error in Sybase connectivity via UNIX
# 1  
Old 02-08-2013
Error in Sybase connectivity via UNIX

Helo Experts,

I have an issue in connecting to sybase from UNIX.

PFB, my code :
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 ====>
Code:
/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:

Code:
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

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by vbe; 02-08-2013 at 01:43 PM..
# 2  
Old 02-08-2013
Well, your test is very gross for the conclusion it reports. What is in the docflow_temp.txt? What were the 10 call options?

Last edited by DGPickett; 02-08-2013 at 05:03 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sybase connectivity in Linux/UNIX

Hi, i am to linux/unix,i am using AIX 5.3. i want to connect sybase database through shell script, when i used "isql", it throws error "isql not found", Do i need to install/configure anything, if yes please tell me how kindly help me on this (4 Replies)
Discussion started by: venkatraman
4 Replies

2. Windows & DOS: Issues & Discussions

Help with Windows to Unix connectivity

Hi Can we pass the parameter from the excel in windows and invoke the unix shell script from excel VBA by passing this parameter and get the results of shell script to the excel sheet? We tried to get the things in unix independently but we still strucked in connecting the excel to... (5 Replies)
Discussion started by: bikky6
5 Replies

3. Solaris

Sybase Connectivity Check through Shell Script

Hi, I need to check the sysbase database connectivity through the Unix Shell Script. Can you help me on the how to write the script to test the sysbase database connection. Thanks in Advance Nandha (0 Replies)
Discussion started by: nandha2387
0 Replies

4. Shell Programming and Scripting

Need to capture error of sybase isql in unix

Hi Gurus, I am very new in Unix, I have 1 script, in which I am truncating the table , then BCP the data in Sybase table, and then loading the data from sybase table to sybase table. every thing is working fine, but the problem is with Error. I made some hanges in my insert statement so... (3 Replies)
Discussion started by: aksar
3 Replies

5. Shell Programming and Scripting

Need to capture error of sybase sql in unix

Hi Gurus, I am very new in Unix, I have 1 script, in which I am truncating the table , then BCP the data in Sybase table, and then loading the data from sybase table to sybase table. every thing is working fine, but the problem is with Error. I made some hanges in my insert statement so... (1 Reply)
Discussion started by: aksar
1 Replies

6. Shell Programming and Scripting

Database connectivity using unix

Hi, I am trying to connect to the database through Unix serer using following command- mysql -u root -Jepadt -D dtdatabase But it giving me error - mysql: unknown option '-J' Can anybody help me to solve this problm Thanks in advance Please use code tags, thanks. (2 Replies)
Discussion started by: pspriyanka
2 Replies

7. Shell Programming and Scripting

Check the Sybase connectivity

Hi , I am able to connect to sybase using the below script ,but i want to check the status of the connectivity like if there is any network failure during downloading the file ,it will come out with exit 1 status .Any help on this ? # isql database_name db_user_name <<EOF select date_val from... (0 Replies)
Discussion started by: mohan705
0 Replies

8. Shell Programming and Scripting

Dos-Unix Connectivity

Hi, Is there any method to connect unix box(Excecuting unix commands through Batch Files) through DOS prompt. (1 Reply)
Discussion started by: shekhar_ssm
1 Replies

9. Shell Programming and Scripting

how to connect to sybase from Unix(AIX)

I have a script given below so can anyone explain me what it does? echo "use $DSQUERY\n go\n insert into ff.SmartCareLogin (username, password, userrole, fullname) values ('$1', '$1', '$2', '$3') go"|isql -Uff -P what is the use of $DSQUERY and go. When i am firiing isql command... (0 Replies)
Discussion started by: sachin.gangadha
0 Replies
Login or Register to Ask a Question