 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Jason Hoskins
Joined: 12 Mar 2004 Posts: 68
|
|
Program Return String |
|
I have an external process that returns a string message. How can I capture that message into a variable with JAL?
|
|
Mon Oct 13, 2008 3:13 pm |
|
 |
jgro
Joined: 09 Oct 2008 Posts: 16 Country: United States |
|
|
|
I have a similar question. How can I change which database job is executed based on the result of a SQL query?
|
|
Mon Oct 13, 2008 4:27 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
 |
 |
I have an external process that returns a string message. How can I capture that message into a variable with JAL? |
It depends on whether you need standard output, standard error or both. For example, if you want both, in JAL you can do it like this (I'm skipping unimportant details)
 |
 |
RunAndWait("cmd /C C:\\path\\to\\my\\program > C:\\temp\\out.txt 2&1", "work dir here", 0, pid)
FileReadAll("C:\\temp\\out.txt", myvar) |
 |
 |
I have a similar question. How can I change which database job is executed based on the result of a SQL query? |
This is completely unrelated. The solution depends on the database type being used. If you are using MS SQL, or Sybase, this so simple, that you wouldn't probably ask for it here. If you are using Oracle, or PostgreSQL, this is not applicable so you wouldn't ask again. Assuming that you are using DB2 or MySQL, you are left to enjoy their primitive SQL language support, their lack of support for SQL blocks, etc…. If I'm not confusing things, you cannot do that directly. Either write a stored procedure that internally uses dynamic SQL to refer to objects using fully qualified names and running EXECUTE IMMEDIATE commands or use the following method. Run your first query returning result using appropriate command line utility that comes with your database, and redirect the output to some file. Read the output file and parse it getting the required database name. After that dynamically construct the required SQL commands specifying fully qualified object names, in DB2 that is dbname.schema.object, in MySQL that is schema.object. Virtually all of that can be done in JavaScript (I think you are using the MP version of 24x7) Or if you feel more comfortable with shell scripting, you can do it using several shell scripts passing parameters as required. If you are using Windows version of 24x7, you can do all of that directly in 24x7 using JAL jobs, which support programmatic commands for executing database queries. These commands take queries as strings and also support concept of database session so that you can dynamically execute things like "USE mydb"
|
|
Mon Oct 13, 2008 5:22 pm |
|
 |
jgro
Joined: 09 Oct 2008 Posts: 16 Country: United States |
|
|
|
 |
 |
 |
 |
I have a similar question. How can I change which database job is executed based on the result of a SQL query? |
This is completely unrelated. The solution depends on the database type being used.... |
I think you misunderstood my question. By "database job" I mean a 24x7 Job that runs a database command. And what I really meant was how do I use the result of a SQL query in a 24x7 Job to determine which 24x7 Job to run next? I want to take advantage of the 24x7 facility to associate a database profile with a SQL query in a job that can be scheduled and trigger the next job based on the result of that query. I don't see in the documentation how to export the results of a database job into the flow control of 24x7 or how to access them via JavaScript.
|
|
Mon Oct 13, 2008 5:32 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Database jobs do not return, process or save result sets. If you need to implement some business logic dependant on actual data results of previous business steps (e.g. jobs), not their completion statuses, you should use some scripting methods to obtain that data and use it as needed. Please provide a bit more details or a test case for what you want to do, so I can be more helpful and I can suggest how 24x7 can be used to automate that processing.
|
|
Mon Oct 13, 2008 5:45 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|