Wednesday, February 5, 2014

FND_FILE / type of Concurrent Program execution methods available in apps

[1] What are different type of Concurrent Program execution methods available in apps?

Oracle Report, SQL * Plus, 
SQL * Loader, PLSQL Stored Procedure,
Java Stored Procedure, Java Concurrent Program, 
Perl Concurrent Program, Multi Language Function, 
Request Set Stag Function, Host, Immediate, Spawned etc.
[2] Why we use FND_FILE package?
The FND_FILE package contains procedures to write text to log and output
files. These procedures are supported in all types of concurrent programs.We 
can use the procedures FND_FILE.PUT_NAMES and FND_FILE.CLOSE for testing
and debugging. 

Note: These two procedures should not be called from a concurrent program.
FND_FILE supports a maximum buffer line size of 32K for both log and output files.

FND_FILE.PUT

Summary
procedure FND_FILE.PUT (which IN NUMBER, buff IN VARCHAR2);
Description
Use this procedure to write text to a file (without a new line character). 
Multiple calls to FND_FILE.PUT will produce concatenated text. Typically 
used with FND_FILE.NEW_LINE.
Arguments (input)
whichLog file or output file. Use either FND_FILE.LOG or FND_FILE.OUTPUT.
buffText to write.

FND_FILE.PUT_LINE

Summary
procedure FND_FILE.PUT_LINE (which IN NUMBER, buff IN VARCHAR2);
Description
Use this procedure to write a line of text to a file (followed by a new line character).
You will use this utility most often.
Arguments (input)
whichLog file or output file. Use either FND_FILE.LOG or FND_FILE.OUTPUT.
buffText to write.
Example
Using Message Dictionary to retrieve a message already set up on the server and 
putting it in the log file (allows the log file to contain a translated message):
FND_FILE.PUT_LINE( FND_FILE.LOG, fnd_message.get );Putting a line of text in 
the log file directly (message cannot be translated because it is hard coded in 
English; not recommended):
fnd_file.put_line(FND_FILE.LOG,'Warning: Employee '||
l_log_employee_name||' ('||
l_log_employee_num ||
') does not have a manager.');

FND_FILE.NEW_LINE

Summary
procedure FND_FILE.NEW_LINE(which IN NUMBER, LINES IN NATURAL := 1);
Description
Use this procedure to write line terminators (new line characters) to a file.
Arguments (input)
whichLog file or output file. Use either FND_FILE.LOG or FND_FILE.OUTPUT.
linesNumber of line terminators to write.
Example
To write two new line characters:
fnd_file.new_line(FND_FILE.LOG,2);

FND_FILE.PUT_NAMES

Summary
procedure FND_FILE.PUT_NAMES
(p_log IN VARCHAR2,
p_out IN VARCHAR2,
(p_dir IN VARCHAR2);
Description
Sets the temporary log and out filenames and the temp directory to the user-specified 
values. DIR must be a directory to which the database can write. FND_FILE.PUT_NAMES 
should be called before calling any other FND_FILE function, and only once per session.

Attention: FND_FILE.PUT_NAMES is meant for testing and debugging from SQL*Plus; 
it does nothing if called from a concurrent program.

Arguments (input)
p_logTemporary log filename.
p_outTemporary output filename.
p_dirTemporary directory name.
Example
BEGIN
fnd_file.put_names('test.log', 'test.out',
'/local/db/8.0.4/db-temp-dir/');
fnd_file.put_line(fnd_file.output,'Called stored procedure');
/* Some logic here... */
fnd_file.put_line(fnd_file.output, 'Reached point A');
/* More logic, etc... */
fnd_file.close;
END;

FND_FILE.CLOSE

Summary
procedure FND_FILE.CLOSE;
Description
Use this procedure to close open files.

Attention: Use FND_FILE.CLOSE only in command lines sessions. FND_FILE.CLOSE should 
not be called from a concurrent program.

Example
BEGIN
fnd_file.put_names('test.log', 'test.out',
'/local/db/8.0.4/db-temp-dir/');
fnd_file.put_line(fnd_file.output,'Called stored procedure');
/* Some logic here... */
fnd_file.put_line(fnd_file.output, 'Reached point A');
/* More logic, etc... */
fnd_file.close;
END;

Note: FND_FILE.LOG or FND_FILE.OUTPUT use to write in file of respective directories.

No comments:

Post a Comment