Why you get program exited with status 127 error in Oracle Apps

Oracle apps provide an option to define a concurrent program with a host as an execution option. For Linux, you can create a shell script and define the program on it. Many times a new developer ends with a Program exited with status 127 error while running the host-based concurrent program.

In this article, let’s explore what is this 127 error and why it comes, and the solution.

Program exited with status 127

This error Program exited with status 127 comes when the respective command is not found or there is no such shell built-in.

Let’s create a shell script as shown below. Move it to the Unix Server to define a host-based concurrent program.

echo "hi how are you"
ls

When I submitted this program, it ended in error with the below message.

hi how are you
../appl/xxap/12.0.0/bin/testhost.prog: line 2: ls
: command not found
../appl/xxap/12.0.0/bin/testhost.prog: line 3:
: command not found
../appl/xxap/12.0.0/bin/testhost
Program exited with status 127

There is nothing wrong with the script.

This is a simple script that displays a message and runs ls command to list files, then why it errored out.

ls is a valid command, but if you check the file with the cat -v command you can see some strange characters ^M at the end of each line.

echo "hi how are you"^M
ls^M
^M

Ctrl M or ^M is the carriage return character. The file is created in MS-DOS format and moved as is to the Unix/Linux operating system. Both use different line termination characters. DOS uses CRLF while Unit LF. This CR character becomes Ctrl M in Unix/Linux. 

Now shell tries to execute, it does not find it as a valid command and complete in error.

So you have to just remove this strange character by using the dos2unix command or ftping in ASCII mode. Both methods convert the file from DOS to Unix format and you will not get this 127 error.

Summary

Just make sure to have valid command in the shell script to avoid Program exited with status 127 in Oracle Apps.

I hope you found this small tip useful. Please share and subscribe.