Issue while running UNIX shell script from Oracle concurrent Program

Arun Antony picture Arun Antony · Nov 23, 2010 · Viewed 8.5k times · Source

I am trying to run a HOST script which I have build in KSH shell using an Oracle Concurrent Program.

My Test script is as follows:

echo "System Parameters passed by Concurrent Manager"
echo "+--------------------------------------------+"
XXWIN_PROGRAM=$0
XXWIN_LOGIN=$1
XXWIN_USERID=$2
XXWIN_USERNAME=$3
XXWIN_REQUEST_ID=$4
echo "XXWIN_PROGRAM    :"$XXWIN_PROGRAM
echo "XXWIN_LOGIN      :"$XXWIN_LOGIN
echo "XXWIN_USERID     :"$XXWIN_USERID
echo "XXWIN_USERNAME   :"$XXWIN_USERNAME
echo "XXWIN_REQUEST_ID :"$XXWIN_REQUEST_ID

shift 4
echo ""
echo "User Parameters passed by Concurrent Manager"
echo "+------------------------------------------+"
echo "1  :"$1
echo "2  :"$2
echo "3  :"$3
echo "4  :"$4
echo "5  :"$5
echo "6  :"$6
echo "7  :"$7
echo "8  :"$8
echo "9  :"$9
echo ""

# Generic Script Begins
# Declaring Constants, Data File Path, Control File Path etc 

CTL_FILE_NAME=$1     # Control File Name(s)
CTL_FILE_PATH=$2     # Control File Path
DATA_FILE_NAME=$3    # Data File Name(s)
DATA_FILE_PATH=$4    # Data File Path
COMPONENT_NAME=$5    # Interface Component Name
SEQ_VALIDATION=$6    # Sequence Name
SUPPORT_EMAIL= $7    # Support e-mail(s) List

# Printing the User Parameters
echo "1  :"$CTL_FILE_NAME
echo "2  :"$CTL_FILE_PATH
echo "3  :"$DATA_FILE_NAME
echo "4  :"$DATA_FILE_PATH
echo "5  :"$COMPONENT_NAME
echo "6  :"$SEQ_VALIDATION
echo "7  :"$SUPPORT_EMAIL

# Assigning the Archive, IN and Prog Dir Paths
ARCHIVE_DIR="$XXWIN_TOP/bin/TEMP/archive"
XXWIN_IN_DIR="$XXWIN_TOP/bin/TEMP/in"
XXWIN_PROG_DIR="$XXWIN_TOP"

# Printing the directories
echo "Archive Directory :" $ARCHIVE_DIR
echo "IN Directory :" $XXWIN_IN_DIR
echo "Program Directory :" $XXWIN_PROG_DIR

i=10
k=5
j=`expr $i + $k`
echo $j

echo $i 

echo "Out of Concurrent Program"

Shell Script program name ends with ".prog"

I am running the concurrent request with the following parameters: alt text

The program completes normal but I am getting the following log messages. alt text

alt text

If I am using #!/usr/bin/ksh the program completes in error so I am running the host file with out that. From the log its clear that when ever a space is encountered in the script, its throwing an error saying "Command not found". Also as you can see that I am doing a simple addition, even that is also not recognized.

Any help in this regards is much appreciated.

Thanks :)

Answer

JOTN picture JOTN · Nov 24, 2010

Did you happen to use an editor on a Windows system to create the script? It's puts a carriage return + line feed character at the end of every line instead of the Unix format of just having a line feed. That messes up the script execution. Unix systems usually have a command like "dos2unix" to convert the file.

If that's not it, I would try running the script manually from the command line to make sure it works.