Sponsored Content
Top Forums Shell Programming and Scripting Receiving error: ./ang.ksh[35]: 0403-057 Syntax error at line 116 : `done' is not expected. Post 302424303 by Scott on Tuesday 25th of May 2010 02:05:10 AM
Old 05-25-2010
Hi.

As silly as it sounds, you have a space after EOF. You need to remove it.

Code:
#!/bin/ksh
#-------------------------------------------------------------------------
# File: ang_stdnld.ksh
#
# Desc: UNIX shell script to extract Store information.
#-------------------------------------------------------------------------
### Set the global variables.
CONNECT=$1
LOG=$MMHOME/log/ang_stdnld_`date +'%b_%d'`.log
ERR=$MMHOME/error/err.ang_stdnld.`date +'%b_%d'`
##SCRIPT_HOME=$MMHOME/oracle/proc/bin
### Check if path where extracts are to be created is passed as arg.
### If this arg is Null, then default to PWD.
if [ "$2" = "" ]
then
DIR=`pwd`
echo "Path is not sent. Defaulting to PWD: "`pwd`
else
if [ -d $2 ]
then
DIR=$2
else
echo "Path $2 does not exist"
exit 1
fi
fi
#-------------------------------------------------------------------------
# Function Name: ang_get_chain()
# Purpose : Create store listing that needs to be processed to
# extract the data.
#-------------------------------------------------------------------------
ang_get_chain()
{
echo "Getting the chain name...\n" >>$LOG
# Set filename to contain this chain 
CHAIN=$DIR/stdnld_chain.lst 
$ORACLE_HOME/bin/sqlplus -s $CONNECT <<EOF >>$CHAIN
set pause off
set echo off
set heading off
set feedback off
set verify off
set pages 0
select distinct sh.chain
from store st,
store_hierarchy sh,
period p
where st.store = sh.store
and p.vdate between st.store_open_date and nvl(st.store_close_date,p.vdate)
order by chain;
EOF 
if [ `grep "^ORA-" $CHAIN | wc -l` -gt 0 ]
then
cat $CHAIN >> $ERR
remove_files
echo "ORA Error while creating Chain listing in ang_get_chain()." >> $LOG
exit 1
fi
for i in `cat $CHAIN`
do
returnedchainvalue=`$ORACLE_HOME/bin/sqlplus -s $CONNECT <<EOF
set serveroutput on;
set pause off
set echo off
set heading off
set feedback off
set verify off
set pages 0
Declare
message VARCHAR2(200);
Begin
select ANGELIC_PKG.ANG_GET_CHAIN_NAME($i) into message from dual;
dbms_output.put_line (message);
End;
/
set serveroutput off;
EXIT;
EOF` 
X=`echo $returnedchainvalue` 
$ORACLE_HOME/bin/sqlplus -s $CONNECT <<EOF >>${X}_en-us_stores_001
SELECT S.STORE, 
S.STORE_NAME, 
S.PHONE_NUMBER, 
A.ADD_1, 
A.ADD_2, 
A.CITY, 
A.STATE, 
A.POST, 
A.COUNTRY_ID, 
'HOMEPAGE', 
'HOURS', 
'CATEGORY', 
'DESCRITPION', 
S.CURRENCY_CODE, 
S.STORE_OPEN_DATE, 
'LATITUDE', 
'LONGITUDE'
FROM STORE S, 
ADDR A, 
STORE_HIERARCHY SH
WHERE A.MODULE='ST'
AND A.COUNTRY_ID='US'
AND A.KEY_VALUE_1=S.STORE
AND A.ADDR_TYPE=01
AND S.STORE=SH.STORE
AND SH.CHAIN=$i;
EOF
done
}
#-------------------------------------------------------------------------
# Function Name: remove_files()
# Purpose : Clean the temporary files created.
#-------------------------------------------------------------------------`
remove_files()
{
echo "Removing temporary files...\n" >> $LOG
# Clean up temp list files.
rm -f $CHAIN_LIST
if [[ -s $ERR ]]
then
:
else
rm -f $ERR
fi
return 0
}
### end remove_files

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

0403-057 Syntax error at line 70. pls help

Hi All, I got a script from one of the unix forums for reporting on filesystem usage and wanted to use it but it keeps giving me the following error. 0403-057 Syntax error at line 70 The script is shown below. Pls help as I am new to UNIX. # set -x # D I S K S P A C E . S H # #... (2 Replies)
Discussion started by: OMONI
2 Replies

2. Shell Programming and Scripting

get_source[34]: 0403-057 Syntax error at line 66 : `"' is not matched.

Hi, I am getting this error in my shell script, kindly help as soon as possible: ################################################################### # Main body of program ################################################################### . /saptech/scripts/common/declare # Defines... (1 Reply)
Discussion started by: vishal_ranjan
1 Replies

3. Shell Programming and Scripting

0403-057 Syntax error at line 52 : `)' is not expected.

Can someone please tell me wht is wrong with the following peice of code? I keep getting the following error - 0403-057 Syntax error at line 52 : `)' is not expected. case "${option_count}" in 1) java -Xms256m -Xmx1536m "${APPLNAME}" "${ACTION_TYPE}" > "${LOGFILE}" 2>... (2 Replies)
Discussion started by: Veenak15
2 Replies

4. Shell Programming and Scripting

ksh: 0403-057 Syntax error: `done' is not expected.

Hi I am getting error 'ksh: 0403-057 Syntax error: `done' is not expected.' when running below script any one can provide inputs on this. ------------------------ if then echo "Report Name |Modification Date|Report File Size|Owner" >SOX_`date +'%Y%m%d'` while read line do... (2 Replies)
Discussion started by: karnatis
2 Replies

5. Shell Programming and Scripting

0403-057 Syntax error

I am getting the error : rocfm/wls_subload/in/processed_files/tel_input_additional_checked_all_mandatory.txt: 0403-057 Syntax error at line 1 : `|' is not expected. >>>>ALL MANDATORY FIELDS CHECKING IS SUCCESSFUL count is 0 ... (3 Replies)
Discussion started by: princetd001
3 Replies

6. Shell Programming and Scripting

0403-057 Syntax error at line 169 : `"' is not matched.

Hi, I am getting this error in my attached shell script, kindly help as soon as possible: Thanks, Andre (2 Replies)
Discussion started by: damoon
2 Replies

7. Shell Programming and Scripting

0403-057 Syntax error at line : `}' is not expected.

i dont know where m i mistaking.. please help me out with this issue :( thanks in advance:rolleyes: one_main() { a=100 while ; do clear echo "##############################################" echo ":: CURRENTLY YOU ARE IN RC AND OC MARKING ::" echo... (1 Reply)
Discussion started by: Puneet sinha
1 Replies

8. AIX

0403-057 Syntax error at line 17 : `(' is not expected.

Hi, I am new to shell scripting.i am trying to mail after my backup completed. Here is my shell script: if ; then egrep (ERROR|error|Error|RMAN-) ${/backup/RMANBKUP/spool/shelltest.log} > /dev/null if ; then RESULT_MSG=WARNING: Errors occurred during the ${ORACLE_SID} Rman... (3 Replies)
Discussion started by: faruqms
3 Replies

9. Shell Programming and Scripting

0403-057 Syntax error at line 17 : `(' is not expected.

Hi, While executing my code i am getting below Error: ./check_disk1: 0403-057 Syntax error at line 55 : `(' is not expected. My code is : #!/bin/ksh PROGNAME=`basename $0` STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 OS=$(uname) AWK="/usr/bin/awk"... (6 Replies)
Discussion started by: abodage
6 Replies

10. Shell Programming and Scripting

0403-057 Syntax error at line 399 : `"' is not matched

Hi Everyone, I am getting strange behavior, same script runs fine without any error in one AIX machine, whereas on another it is throwing this error "0403-057 Syntax error at line 399 : `"' is not matched", I also ran the script in debug mode. This is the output, still doesn't say anything.... (2 Replies)
Discussion started by: sid1987
2 Replies
shells(4)							   File Formats 							 shells(4)

NAME
shells - shell database SYNOPSIS
/etc/shells DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser- shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root. A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search the file. Blank lines are also ignored. The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/ksh93, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh, /bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/ksh93, /usr/bin/pfcsh, /usr/bin/pfksh, /usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh, and /usr/sfw/bin/zsh. /etc/shells overrides the default list. Invalid shells in /etc/shells could cause unexpected behavior, such as being unable to log in by way of ftp(1). FILES
/etc/shells list of shells on system SEE ALSO
vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4) SunOS 5.11 20 Nov 2007 shells(4)
All times are GMT -4. The time now is 09:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy