How to run a batch file in siebel escript and execute plsql package through a batch file by passing a variable and to get the output - siebel

My requirement is to execute a plsql package through siebel escript. For that, I am planning to write a batch file which can be invoked in the escript.
in the batch file, I want to execute the package. But stuck at passing the input to package and get the output from it. Please help me with the code.
Thanks.

The quickest answer might be using Clib Send Command Method. This can be used to run commands on the siebel server, on any OS. eg:
Clib.system("dir /p C:\Backup");
So you could try invoking your bat file
Clib.system("C:\custom.bat arg1 arg2");
You will have to handle the variables in the bat file (or .sh) file and invoke your PLSQL from there.
The flip side is that there is no way of getting any output from the command line back to Siebel.
https://docs.oracle.com/cd/E14004_01/books/eScript/C_Language_Reference101.html#wp1008859

You can get the output back into Siebel indirectly by having the command pipe it to a text file and having Siebel process that file.

The only way to do this is to call the batch with Clib.system and have it save the output into a file. You then need to have some BS/Workflow to read the file and delete it.
It will work reliably if you are careful with the file naming to avoid concurrency issues.

Related

Archive file after MFT transfer

We're using IBM MQFT for a file transfer between 2 systems and we have a requirement to move the original file to a different location on the source file system once the transfer is complete.
From the knowledge center MFT documentation what I can see is that we may need to write a user exit program to do this. I guess I would set the source_file_disposition to "leave" and use the exit program to move the file.
Is that the correct way to go about it, or there a simpler way to do this that I'm not seeing?
Regards
There are few options for you.
You can run a command or a shell script or an Ant script as part of postSrc parameter of fteCreateTransfer command. Once transfer is complete MFT will run the specified command to move the files from source to another directory.
As you mentioned a Java exit can be written to move the files after transfer completion.
You may want to refer samples Java exit and Ant Script here.

Display matlab's program's output calling for another c++ program

I'm not sure if my question is clear:
I have a C++ project that I run from Qtcreator, this program call another c++ script outside the project. This last one runs a shell script calling a bunch of matlab scripts.
I want to display output from the matlab scripts, disp doesn't work.
I tried to write the values I want to read in a .txt file. The file is created but stay empty.
I tried these lines to write in a file:
fileId= fopen('imagename.txt','a');
fprintf(fileId, 'test : %s',imageName);
fclose(fileId);
I also tried assignin with the values I want to show but they're not kept within matlab's workspace.
I can't change the architecture of the whole program because it's a big project made by someone else I have to continue.
Do you have another way to watch what is going on the matlab scripts?
It's difficult to launch them directly from Matlab as I don't have access to their inputs values. I can hardly change the c++ script calling them to display theses values because I have a 'reference to ofstream is ambiguous' issue when I try to build it, so I will have to debug something made by someone else and non commented.
The fact that the file you write to stays empty is weird and I would try to find the reason regardless of your question.
Anyway, since you call Matlab from a shell script I guess you use 'matlab -r' option with your script name, or something similar. In that case you can use the -f option which tells Matlab to write the command line output to a log file:
matlab -logfile output.log

log4cplus - flush file before writing in it

My need is quite simple:
with log4cplus, I'd like to be able to write a log in a log file and to flush the log file everytime before I write in it. This way, while I run my application, I will only have one single line in my log file.
I've tryed the append=False property, but it only flush the log file at startup.
I could do it by hand in C++ but I don't want to write C++ code as the product is already in prod.
Any idea ?
Thanks,
Use the ImmediateFlush property to force the file appender to flush after each event.

How to capture the result of DOS Commands in C++

I am creating a windows application that must capture results of several DOS Commands without the command prompt opening and save them into a string. I am using the borland libraries.
system("dir") therefore is not good. The result of each command needs to be written to a string variable so I can write it to a log and a separate file.
I have an XML file where they are defined.
The thing i'm struggling on the most is actually capturing the output into a string variable. I have heard of _popen but having problems trying to use it.
I think what you really want is freopen() that allows you to redirect the usual streams to a file (either temporary or the separate file you mentioned), and when the process closes, read the file into your log.
I assume the 'result' is the output from the command, and not its return value.

InvokeProcess custom activity does not invoke

I'm doing my first steps on Customizing the TFS builds. I created an InvokeProcess that calls a batch file. I see in the log that the batch file is called, but I do not see that the batch file is executed. In the FileName I put the located and the name of the file (for example "C:\myBatch.bat".
Just to see it working, I called in the file name also "Notepad.exe" and also it did not work.
What can be the problem?
Thanks
Specify the WorkingDirectory property for the Invoke Process Activity, If you have file path as "C:\myBatch.bat" then set WorkingDirectory as "c:\"
Also, you can enable the logging for Invoke Process Activity. Check here:
https://blogs.blackmarble.co.uk/blogs/rfennell/archive/2010/02/23/logging-results-from-invokeprocess-in-a-vs2010-team-build.aspx