понедельник, 26 августа 2013 г.

Host Concurrent Program

Common information about Host Concurrent Program, find on many web-sites


---------------------------------------
SOURCE: http://oracleappsnotes.wordpress.com/2012/02/21/all-about-host-concurrent-programs/
---------------------------------------

One of the things to remember while registering a host concurrent program is that the first five parameters are reserved by Oracle E-Business Suite for its own use. The sixth parameter onwards is used for user-defined concurrent program parameters. The first five parameters refer to the following:

$0: The shell script to be executed
$1: Oracle user/password
$2: Applications user_id
$3: Application user_name
$4: Concurrent program request_id

In addition to these, the environment variable FCP_LOGIN is also used to store the Oracle user/password.

The steps required to register a shell script as a concurrent program are:

1) Define Concurrent Program with Executable Type = Host with parameters as required. For this example, I have defined one parameter with default value ‘ABCDEF’
2) Define Execution File Name = Name of .prog file without extension
3) Add program to request group for Responsibility
4) Copy your .prog file (Shell Script) to Custom Top Bin directory (Eg: $XXCUST_TOP/bin)

#!/bin/sh
echo 'Printing parameters....'
echo '0:'$0
echo '1:'$1
echo '2:'$2
echo '3:'$3
echo '4:'$4
echo '5:'$5
 
echo 'FCPLOGIN:'$FCP_LOGIN
echo 'Finished printing parameters.'

5)Set protection on the Host Program

6) Create symbollic link by executing below commands on Unix Server

cd $XXCUST_TOP/bin
ln -s $FND_TOP/bin/fndcpesr sample_file

WHERE sample_file = Name of your Host program script

7) The concurrent program will complete with status ‘Error’ and the log file will contain the following:

Printing parameters….
0:/u01/oracle/visappl/cs/11.5.0/bin/myscr.prog
1:APPS/APPS
2:1001530
3:EBUSINESS
4:2721405
5:ABCDEF
/u01/oracle/visappl/cs/11.5.0/bin/myscr
Program exited with status 1

There are no defined exit commands to return a warning status. However, it can be done by using the FND_CONCURRENT.SET_COMPLETION_STATUS API  to set the completion status of the request to ‘Warning’. Gareth Roberts deserves a big ‘Thank You’ for posting this on Oracle Forums.

#!/bin/sh
echo 'Printing parameters....'
echo '0:'$0
echo '1:'$1
echo '2:'$2
echo '3:'$3
echo '4:'$4
echo '5:'$5
 
MYSTATUS=`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;
!`
 
echo 'FCPLOGIN:'$FCP_LOGIN
echo 'Finished printing parameters.'
 
This solution makes use of a SQL script to initialize a session with the request_id of the concurrent program using FND_GLOBAL.INITIALIZE and then sets the completion status. Upon execution, the concurrent program ends with a ‘Warning’ status and generates the following output:

Printing parameters….
0:/u01/oracle/visappl/cs/11.5.0/bin/myscr.prog
1:APPS/APPS
2:1001530
3:EBUSINESS
4:2721408
5:ABCDEF
FCPLOGIN:APPS/APPS
Finished printing parameters.

One important thing to notice is that echoing the parameters $1 and $FCP_LOGIN leads to the Oracle user/password being written to the log file. This can be prevented by using the options ENCRYPT and SECURE while defining the concurrent program. ENCRYPT signals the Concurrent Manager to pass the Oracle password in the environment variable FCP_LOGIN. The Concurrent Manager leaves the password in the argument $1 blank. To prevent the password from being passed, enter SECURE in the Execution Options field. With this change, Concurrent Manager does not pass the password to the program.
For this example specifying SECURE in the concurrent program options:



and then running the concurrent program does not set the completion status to ‘Warning’ since the Oracle user/password is not passed and the SQL script cannot run. This can be observed from the contents of the log file.

Printing parameters….
0:/u01/oracle/visappl/cs/11.5.0/bin/myscr.prog
1:APPS/
2:1001530
3:EBUSINESS
4:2721412
5:ABCDEF
FCPLOGIN:
Finished printing parameters.

If we set the options field in the concurrent program to ENCRYPT

 

then the Oracle user/password will be passed only to $FCP_LOGIN and not to $1. We can change the SQL  script to use $FCP_LOGIN instead of $1 and execute the concurrent program. It will now complete with a ‘Warning’ status since the Oracle user/password was passed to the script through $FCP_LOGIN. This can be verified from the contents of the log file:

Printing parameters….
0:/u01/oracle/visappl/cs/11.5.0/bin/myscr.prog
1:APPS/
2:1001530
3:EBUSINESS
4:2721409
5:ABCDEF
FCPLOGIN:APPS/APPS
Finished printing parameters.

Note:
1. Use ${10}, ${11} instead of $10,$11 to refer to double-digit parameters
2. The FND_GLOBAL.INITIALIZE procedure is used to set new values for security globals during login or when the responsibility is changed, it accepts the following parameters:


session_id in out number,
user_id in number,
resp_id in number,
resp_appl_id in number,
security_group_id in number,
site_id in number,
login_id in number,
conc_login_id in number,
prog_appl_id in number,
conc_program_id in number,
conc_request_id in number,
conc_priority_request in number,
form_id in number default null,
form_appl_id in number default null,
conc_process_id in number default null,
conc_queue_id in number default null,
queue_appl_id in number default null,
server_id in number default -1
 


1 комментарий: