SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Program Return String

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Program Return String
Author Message
Jason Hoskins



Joined: 12 Mar 2004
Posts: 68

Post Program Return String Reply with quote
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 View user's profile Send private message
jgro



Joined: 09 Oct 2008
Posts: 16
Country: United States

Post Reply with quote
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7952

Post Reply with quote
Quote:
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)

Code:
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)



Quote:
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 View user's profile Send private message
jgro



Joined: 09 Oct 2008
Posts: 16
Country: United States

Post Reply with quote
SysOp wrote:
Quote:
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 View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7952

Post Reply with quote
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 View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.