Calling a batch file or a PL/SQL statement in Siebel eScript

This article has been contributed by Prashant Jha. In this article he explains use of Clib.system function to execute processes outside Siebel.


Here is another interesting requirement wherein we are automating the complete process. We need to call the Batch file during the course of a workflow. The client wants to run some extracts on press of a button in GUI. For this we can build a WF which incorporates a custom Business Service to process the batch file we have written for extracting records.

There can be two ways to fulfill this requirement:

  1. Clib.system() Method
  2. SElib.dynamicLink() Method

I have incorporated Clib.system() in my script. It’s a one line statement with which I called the batch file and ran it successfully. The format goes something like this Clib.system(“D:\\CSExtract\\OLD\\extract_Test.bat”); (text in double quotes represents the exact path of the batch file)

Another important feature of this method is to execute any statement from the command line; we can carry out any operation we want.

Clib.system(“copy c:\\test.txt c:\\shared\\test.txt”);

With the following example we can call the SQL procedure also

Clib.system(“sqlplus UserName/password@dbname @//SBA_81/siebsrvr/bin/TEST_PROCEDURE.SQL”);

 

SElib.dynamicLink() Method : I didn’t get a chance to work on this but I am presenting the format for the same.

SElib.dynamicLink(Library, Procedure, Convention[, [desc,] arg1, arg2, arg3, …, argn])

Parameter Description
Library Under Windows, the name of the DLL containing the procedure; under UNIX, the name of a shared object; can be specified by fully qualified path name
Procedure The name or ordinal number of the procedure in the Library dynamic link library
Convention The calling convention
desc Used to pass a Unicode string; for example, WCHAR
arg1, arg2, arg3, …, argn Parameters to the procedure

For more on this please go through:

http://download.oracle.com/docs/cd/E05553_01/books/eScript/eScript_JSReference244.html#wp1014383

These statements can be incorporated in the eScript to build a custom BS. We can then automate any job from a click of a button or any other way possible.

2 Responses to Calling a batch file or a PL/SQL statement in Siebel eScript

Leave a Reply

Contribute