Oracle Cloud offers a broad portfolio of software as a service applications, platform as a service, and social capabilities, all on a subscription basis. Oracle Cloud delivers instant value and productivity for end users, administrators, and developers alike through functionally rich, integrated, secure, enterprise cloud services.
 Get a Free Magzine ...Profit:The Executive's Guide to Oracle Applications

Subscribe to the OracleAppsHub to receive notifications when there are new posts:

 get RSS feed
 Oracle Fusion Applications (OFA) is a portfolio of next generation suite of software applications from Oracle Corporation. It is distributed across various product families; including financial management, human capital management, customer relationship management, supply chain management, procurement, governance, and project portfolio management
 Get a Free Magzine ...Profit:The Executive's Guide to Oracle Applications

4 Steps for Host based concurrent program

Posted on June 18th, 2007 by Sanjit Anand |Print This Post Print This Post |Email This Post Email This Post

Have you tried OracleappsHub in ipad/iphone/smart Phone? Don't wait. try it today

These are the few steps which is required to make a host based Concurrent Program.

The first steps would be , you have to create a script and save as .prog extension and put into your application top bin folder.
If your custom application is XX then the scripts should goes to $XX_TOP/bin
For example, call the script CUSTOM.prog and place it under

Step 2
Now,you have understood , the execution of unix program is bit different in oracle application. The only things you have to notice is you need to pass 4 mandatory parameter to execute host program.
The other way around is ,you can use fndcpesr and link with your host program.It means the fndcpesr will take care of your 4 mandatory parameter.

You have to simply create a soft link with $XX_TOP/bin folder.

   ln -s $FND_TOP/bin/fndcpesr 

Your script will be passed at least 4 parameters, between $1 and $4.
These are:
orauser/pwd,
userid,
username,
and request_id

Any other parameters you define will be passed in $5 and higher.
Make sure your script returns an exit status also.

What additional piece need to incorporate in code
you need to simply
ORA_USER_PASS=$1
USERID=$2
USERNAME=$3
REQUESTID=$4

With or without extn '.prog'
You can register an host application without the prog extension. Your script will not have any extension. However in order to make this work you must have logic in your host application that parses the parameter string passed to it and extract the individual parameters out of it. This is required because the Concurrent manager passes 1 string containing all the parameters, to the host program. In programs linked to the fndcpesr
program, the fndcpesr parses it into the individual parameters.

How can you return an error status of the concurrent programs?

Yes, By default, a shell script returns success (status code 0). In case of error script traps an error, use the UNIX exit command 'exit 1' to return
failure (status code 1) to the concurrent manager running the program."

Final Note of 'fndcpesr'
fndcpesr is a standard utility available in $FND_TOP directory. Its mainly used by the application to parse arguments for shell scripts.

Related Posts

Posted in AOL | 33 Comments »Email This Post Email This Post | Print This Post Print This Post

Have you tried OracleappsHub in ipad/iphone/smart Phone? Don't wait. try it today
33 Responses
  1. ranjith Says:

    hi,

    what if i require to run the shell scripti from another responsibility other than sys admin

    Ranjith

  2. Anand Says:

    Ranjith,

    could you elaborate more….in term of clarity of the quetsion.

    If you are trying to run from other responsiblity , simply attach that requset to requset group under which you are looking for.

    take a note, Respoisblity is tied up with Requset group and menu, more over userid is tied with Resposniblity. There is only exception of not having requset group, when you will take alternate approch like FND_SUBMIT API’or submitting through CONCSUB..ie directly from host.

  3. Amresh Says:

    I am calling pl/sql procedure,from my shell method concurrent prog.
    can i use fnd_file.put_line to log message ?

  4. elmaris Says:

    As log file for Host concurent program contains output whichs is sent to stout from the shell script, I think you have to use for example dbms_output.putline to write log messages. have to check

  5. Ash Says:

    I use a shell script without extension and I have two custom parameters defined in the concurrent manager. I’m able to get the values through my shell script, by reading the whole parameter list and parsing it. However, the parameters are encolosed with double quotes which is causing issues. How do I get rid of the double quotes surrounding my parameters?

    Help is greatly appreciated.

  6. Senthil Kumar.K Says:

    Hi,
    I want to pass 7 parameters to my Shell Script program by using Concurrent Program in Oracle Apps. While i try to Run the program. it didn’t pick the parameters correctly. I use the code in my Shell Scripts are:
    l_to_mail_id=$5
    l_cc_mail_id=$6
    l_file1_path=$7
    l_file1_name=$8
    l_file2_path=&9
    l_file2_name=&10
    l_subject=$11
    But its not working fine. Please help me to correct this.
    Thanks in Advance.

    Regards,
    Senthil Kumar.K

  7. Sanjit Anand Says:

    there should be no problem ….as far as you attached with fndcpesr by mean of soft line…
    additionally you can pass as many parameter as you can….the more over you need to check the corresponding mapping..
    I will check my script, will send you offline

  8. Rajkiran Bingi Says:

    Senthil,
    I guess u have problems catching $10, $11 values.

    These should be ${10}, ${11} and so on.

    Try it.

    regards,
    Rajkiran.

  9. Amresh Says:

    How to get program status or “WARNING” in host method concurrent program?

  10. Martand Joshi Says:

    Hi,

    We have two servers, database node and application node. Concurrent Service is installed on Database Node. I want to write a program to Load the data using SQLLOADER, which I am invoking using Host File. For this program, data file will be residing on Application Node. But as Concurrent Service is on Database Node, I want to know, if I can still run host executable file from application node.

    Regards,
    Martand Joshi

  11. raj Says:

    I have similar problem as Amresh.

    Can some one shed some light on
    how to get program status or “WARNING” in host method concurrent program?

    Regards,
    Raj.

  12. ANIL KRISHNAN Says:

    Hi,

    I have a simple CC Program which execute a shell script. After the execution the Log files are not created but the ‘echo’ commands are not displayed. I have used a simple echo “Hello World”, even that is not getting displayed in the Log. Please advice

    thanks
    Anil Krishnan

  13. Vishnu Pratap Patel Says:

    Dear Sanjit,

    As per your saying, i added to my test_data_host_prog.prog file four compulsory parameters ,but during registration in sysadmin -> concurrent-> program -> define
    ,in parameters window i had left all blank.
    During running of the concurrent program it is giving error: The executable file /dev02/CPS/apps/apps_st/appl/ja/12.0.0/bin/test_data_host_prog for this concurrent program can not be executed.

    my script file is as follows:

    # Parameters passed into program

    ORA_USER_PASS=$1
    USERID=$2
    USERNAME=$3
    REQUESTID=$4

    #LOGON_STRING=’apps/appscps@cps’
    #FILENAME=$5

    sqlload userid=apps/appscps@cps control=/usr/tmp/test_data_host.ctl data=/usr/tmp/test_data_host.txt log=/usr/tmp/test_data_host_log.log bad=/usr/tmp/test_data_host_bad.bad ERRORS=100000 silent=FEEDBACK <<!
    !

    RC=$?
    echo “The sql loader exit code for loading Header table is :”$RC

    if [ $RC -eq 0 -o $RC -eq 2 ]
    then
    echo ‘Loading of file table successful.’
    else
    echo ‘Error: Loading of file table has errors. Sqlload return code is ‘$RC
    exit 1
    fi

    case “$RC” in
    0) echo “SQL*Loader execution successful” ;;
    1) echo “SQL*Loader execution exited with failure, see logfile” ;;
    2) echo “SQL*Loader execution exited with warning, see logfile” ;;
    3) echo “SQL*Loader execution encountered a fatal error” ;;
    *) echo “unknown return code $RC” ;;
    esac

    kindly help me with the same.

    Thanks & Regards

    Vishnu Pratap Patel

  14. Vishnu Pratap Patel Says:

    hello all,

    Dear Friends, i want to use host command in a concurrent request to load data in a table from a flat file .

    for that i wrote one flat file(test_data_host.txt) , one control file(test_data_host.ctl) , one script file(test_data_host_prog.prog)

    Finally i made one concurrent program BPIL_TEST_DATA_HOST and saved it as ‘ HOST ‘.

    i added to my test_data_host_prog.prog file four compulsory parameters ,but during registration in sysadmin -> concurrent-> program -> define ,In parameters window, i had left all blank.(previously, same was running when i made one link from ‘$FND_TOP/bin/fndcpesr’ file using command: *ln -s $FND_TOP/bin/fndcpesr test_data_host_prog * through telnet.)

    During running of the concurrent program it is giving error: The executable file /dev02/CPS/apps/apps_st/appl/ja/12.0.0/bin/test_data_host_prog for this concurrent program can not be executed.

    my files data is attached here with:

    1) test_data_host.txt file:

    Tamojit,1,history
    Vishnu,2,maths
    Krishna,3,HRMS

    *******************

    2) test_data_host.ctl file:

    LOAD DATA
    APPEND
    INTO TABLE BPIL_TEST_CONTROL_FILE
    FIELDS TERMINATED BY “,”
    OPTIONALLY ENCLOSED BY'”‘
    TRAILING NULLCOLS
    ( name1,
    class1,
    subject,
    record_status CONSTANT ‘NEW’)

    *******************************

    3) test_data_host_prog.prog file:

    # Parameters passed into program

    ORA_USER_PASS=$1
    USERID=$2
    USERNAME=$3
    REQUESTID=$4

    #LOGON_STRING=’apps/appscps@cps’
    #FILENAME=$5

    sqlload userid=apps/appscps@cps control=/usr/tmp/test_data_host.ctl data=/usr/tmp/test_data_host.txt log=/usr/tmp/test_data_host_log.log bad=/usr/tmp/test_data_host_bad.bad ERRORS=100000 silent=FEEDBACK <<!
    !

    RC=$?
    echo “The sql loader exit code for loading Header table is :”$RC

    if [$RC -eq 0 -o $RC -eq 3 |http://forums.oracle.com/forums/]
    then
    echo ‘Loading of file table successful.’
    else
    echo ‘Error: Loading of file table has errors. Sqlload return code is ‘$RC
    exit 1
    fi

    case “$RC” in
    0) echo “SQL*Loader execution successful” ;;
    1) echo “SQL*Loader execution exited with failure, see logfile” ;;
    2) echo “SQL*Loader execution exited with warning, see logfile” ;;
    3) echo “SQL*Loader execution encountered a fatal error” ;;
    *) echo “unknown return code $RC” ;;
    esac

    kindly help me with the same to run the concurrent request successfully to load the data .

    Thanks & Regards

    Vishnu Pratap Patel
    (vishnu.patel@tcs.com)

  15. Sanjit Anand Says:

    echo should work.what is version of your oracle u are using.

    Command like
    echo “Line 1.”
    echo “line 2.”

    suppose to print
    Line 1.
    Line 2.
    in log file.

    are u sure prog completed successfully. some time access previlege also causing , as there is no debug options unless developer is realize that something pre-requssite is not performed yet.

    this is simple host based concuuurent prog used to Moves files from one directory to another

    Three input parameter is there.

    once you put the script in to Unix box, donot forgot to run this command
    ln -s -f $FND_TOP/bin/fndcpesr XXTEST

    –here is code

    # Initialise environment variables
    echo " Initialise location specific environment variables" 
    ORA_USER_PASS=$1
    USERID=$2
    USERNAME=$3
    REQUESTID=$4
    P_SOURCE_DIR=`eval echo $5`
    P_TARGET_DIR=`eval echo $6`
    P_FILENAME=$7
    
    DIR=`eval echo $1`
    
    # Initialise common environment variables
    echo " Initialise common environment variables" 
    SCRIPT=XXTEST.prog
    
    # Variables for Load filenames
    echo " " 
    echo "Input Directory = " $P_SOURCE_DIR
    
    # Setting the Directory Names
    CTLDIR=$XXPH_TOP/bin
    LOGDIR=$XXPH_TOP/log
    BADDIR=$XXPH_TOP/log
    
    
    # Setting the Log file for the .prog file
    REPFILE=$APPLCSF/$APPLLOG/l$REQUESTID.req
    PROBLEMS=0
    # ----------------------------------------------------------
    echo "\n Start" $SCRIPT
    echo " ************************************"
    # ------------------------------------------------------------------
    
    # Display all parameters entered
      echo " For Supplier data conversion -- Parameters entered:-" >> $REPFILE
      echo " SQL*Plus userid   = " $USERID >> $REPFILE
      	  
    # Display Other parameters :-
    
      echo "Other Parameters :-" >> $REPFILE
      echo "--------------------" >> $REPFILE
      echo "Source directory = " $P_SOURCE_DIR >> $REPFILE
      echo "Target directory = " $P_TARGET_DIR >> $REPFILE
      echo "Filename         = " $P_FILENAME >> $REPFILE
      
    echo "At the end of Parameter Listing " >>  $REPFILE 
    
    #
    # Check if the Data Files Exist 
    echo "At the start of Data Files Check " >>  $REPFILE
    #
    if [ ! -f $P_SOURCE_DIR/$P_FILENAME ]
    then
        echo  $P_SOURCE_DIR/$P_FILENAME " does not exist"
        echo "**************************************************" >> $REPFILE
        echo "*$P_SOURCE_DIR/$P_FILENAME " does not exist"           *" >> $REPFILE
        echo "**************************************************" >> $REPFILE
        PROBLEMS=1
        exit 1
    fi
    #
    echo "At the end of Data File Check " >>  $REPFILE   
    #
    #   Move the file to the target directory
    # ------------------------------------------------------------------
    mv $P_SOURCE_DIR/$P_FILENAME $P_TARGET_DIR
    if [ $? != 0 ]
    then
        echo "**************************************************" >> $REPFILE
        echo "*$P_SOURCE_DIR/$P_FILENAME " failed to move "          *" >> $REPFILE
        echo "**************************************************" >> $REPFILE
        PROBLEMS=1
    fi
    mv $P_SOURCE_DIR/$P_FILENAME'.o' $P_TARGET_DIR
    if [ $? != 0 ]
    then
        echo "**************************************************" >> $REPFILE
        echo "*$P_SOURCE_DIR/$P_FILENAME'.o " failed to move "    *" >> $REPFILE
        echo "**************************************************" >> $REPFILE
        PROBLEMS=1
    fi
    # ------------------------------------------------------------------
    #
    if test $PROBLEMS = 1
    then
        echo "\nUnsuccessful termination of" $SCRIPT >> $REPFILE
        echo "\n------------------------------------" >> $REPFILE
        exit 1
    else
        echo "\n----------------------------------" >> $REPFILE
        echo "Successful termination of" $SCRIPT >> $REPFILE
        echo "----------------------------------" >> $REPFILE
    fi
    exit 0
    
  16. Sanjit Anand Says:

    Dear Vishnu,

    there should not be any issue.

    errors message seems there need a proper access on file in unix.

    Do a quick check

    1. when create a soft line you should do like

    ln -s -f $FND_TOP/bin/fndcpesr test_data_host_prog
    

    2. Make sure soft link is create or not

    3. Make sure you should have proper access on the site.

    When you are calling sqllodaer from its better use directly from home and just pass userid which internally passed by fndcpesr prog.

    $ORACLE_HOME/bin/sqlldr USERID=$ORA_USER_PASS CONTROL=$CTLDIR/$LOADER1.ctl LOG=$LOGDIR/$LOADER1.log BAD=$BADDIR/$LOADER1.bad ERRORS=0 DATA=$LOGDIR/filenames.dat >>$REPFILE
    

    and you can see how these are derived from parameter

    ORA_USER_PASS=$1
    USERID=$2
    USERNAME=$3
    REQUESTID=$4
    P_INPUT_DIR=`echo $5`
    
    # Setting the Control File Names
    LOADER1=XXTESTLOAD
    
    
    CTLDIR=$XXPH_TOP/bin
    DATDIR=`echo $P_INPUT_DIR`
    LOGDIR=$XXPH_TOP/log
    BADDIR=$XXPH_TOP/log
    

    Let me know , in case if this does not work, I will send you code.send me offline message.

  17. Chris Says:

    Hi,

    this tutorial is perfect, thank you for your information.

    Do you have an example of a host program which would ftp a file from the apps server to a remote ftp server?

  18. Raks Says:

    How to send the status as WARNING for a HOST concurrent program

  19. Marcelo Says:

    I need the same for r12…. It seems that something was changed…

    Best Regards,
    Marcelo

  20. Mervin14 Says:

    Hello to all,

    Same as Marcelo, my host-based concurrent program which is working in 11i is not working in R12. Anyone know what’s the reason?

    Thanks in advance,
    Mervin14

  21. Sanjit Anand Says:

    Marcelo ,Mervin

    There is no such difference in R12 and R11i of the host program based concurrent program.

    I am suspecting either your softlink is not created or loader file path is not correct.

    Are u getting some message or your program is ending with red color error.

    Could you share your log file offline at sanjitanand@yahoo.com, and if posssible share the screen snapshots of
    1. Concurrent registration of prog
    2.screen snap shots of $FOLDER/bin
    i want to make sure privileges
    3.log file of the concurrennt program

  22. Rohan Says:

    Yeah, I also have the same problem.
    It doesn’t seem to work in r12.
    Also how do I check the loader file path

  23. Rohan Says:

    Got it resolved.There was something wrong with the fndcpesr file itself in r12.
    Took the fndcpesr file from an r11 instance and copied it into r12 $FND_TOP/bin/ and renamed it to fndcpesr1.
    Then created the link to this file.
    It works!!!

  24. Mohit Says:

    I have to print output in output file instead of log file.What i have to do for that.

  25. Rylan Says:

    To write to output, find the name of the output file by querying FND_CONCURRENT_REQUESTS in the shell script. Then redirect your output and append it to the output file.

  26. JP Says:

    Hi I ran the concurrent program, and it completed normally. Now i want to know the given parameter name and value for that which i entered . could any one give me the query to retrieve all the given parameter name and value accordingly by request id.

    Thanks,
    JP.

  27. Sachin Goel Says:

    How to send the status as WARNING for a HOST concurrent program.

  28. Tom Says:

    Make sure to load the script onto the server in ASCII mode and not in Binary mode. Our concurrent program could not find the script until we reloaded the script in ASCII.

  29. Anupam Says:

    Thx a lot :)

  30. Pradeep Says:

    Hi Sachin Goel,

    Here is the way how to set WARNING for a HOST concurrent program.

    In UNIX, you have only 2 status i.e; True or False.

    If you use exit 1 you can see Completed Error stauts for Concurrent request.

    To Set other status follow this:

    MYOWNSTATUS=`sqlplus -s $1 <<!
    SET HEADING FEEDBACK OFF PAGESIZE 0
    declare
    l_result boolean;
    l_session_id number;
    begin
    fnd_global.INITIALIZE(l_session_id, null, null, null,null, -1, null, null, null, null, $4, null,null,null,null,null,null,-1);
    l_result := fnd_concurrent.set_completion_status(‘WARNING’,’Review log file for details.’);
    commit;
    end;
    /
    exit;
    !`

    Include the above code in your script. This will work

    Note: $1 is Username/Password and $4 is FCP_REQID (Request id).
    Do let me know if you need any more info.

  31. Steps for Host based concurrent program: Sample code | OracleApps Epicenter Says:

    […] 7. Go to system admin,complete the steps as mention in this post. […]

  32. lalit sanodia Says:

    How to send the status as warning for a Host concurrent program.

  33. Ramesh Says:

    hi Snajit,

    I have a req- like I have a SQL query which returns like – 700 records – now – this SQL script need to be scheduled – to run everymonth 15th.

    Req: When we run this SQL through Concurent request – the out of this SQL script sud be placed in one of the FTP server location in XLS format

    Qsn: – how do I start for this req – like after I read ur tthread I learned – that I have to register as a Host program – but how abt that SQL whcich returns – values ??

    plz shed some light on this to start..
    my email – rameshkumar.pujari@gmail.com

    thax in adv

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.