4

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

Vincent Malgrat
  • 66,725
  • 9
  • 119
  • 171
Arun Antony
  • 573
  • 4
  • 13
  • 26

4 Answers4

2

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.

JOTN
  • 6,120
  • 2
  • 26
  • 31
  • I am using Notepad++ as the editor and not notepad. I have developed a 500 lines of code and its running perfectly from the unix box. But I am not able to run it from oracle application :(. – Arun Antony Nov 24 '10 at 05:50
0

When either VI or CAT displays specials characters, the conversion to Linux/Unix compatibility is not completely done. There's often many solutions, maybe Notepad++ is the cause here. Maybe not. Writing scripts on the OS itself, is not only faster (no need for FTP, which is already a big plus), but you don't have to face these annoying control-M characters. The ASCII conversion sometimes fails. You can also try another FTP program. Or avoid it all togheter, as mentioned above.

tvCa
  • 796
  • 6
  • 13
0

When I tried to read the file using CAT -vt <filename>, I could see that the file contains special characters such as ^M and ^I. This may be because of the file transfer mode(but I transferred in ASCII mode, still the special characters where appearing).

I opened a VI editor and pasted the same script. Save the file, tried to run the script, It was working fine.

I still didn't get how the special characters appeared. I used notepad++ as my editor.

Arun Antony
  • 573
  • 4
  • 13
  • 26
0

Notepad++ can save the file in Windows CRLF or Unix/Linux LF format Notepad++ Edit-EOL Conversion-Choose Windows Or Unix, and then save it. It would be nice if the concurrent manager were smart enough to convert it for you when needed.