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
CHAIN(3)						 MBK UTILITY STRUCTURE DEFINITIONS						  CHAIN(3)

NAME
chain - mbk lisp-like service structure DESCRIPTION
The chain is used for any purpose, when a list of pointer is required. The use of this structure is strongly recommanded, when such a need occurs. The declarations needed to work on chain are available in the header file "/labo/include/mut315.h", where '315' is the actual mbk version. The following C structure supports the description of the chain : typedef struct chain { struct chain *NEXT; void *DATA; } chain_list; NEXT Pointer to the next chain of the list. DATA Generic pointer used to point to any kind of object. Do not forget to cast the pointer back to its previous type when using this field. Remark : a specialized memory allocator has been built in order to create and free chain_lists, so absolutly avoid to create or free them an other way than through the access functions. SEE ALSO
mbk(1), addchain(3), freechain(3), delchain(3). BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. ASIM
/LIP6 October 1, 1997 CHAIN(3)
All times are GMT -4. The time now is 01:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy