Page 1 of 1

inserting rows into a table at runtime

Posted: Tue Feb 15, 2005 9:45 pm
by rajiivnb
Hi All,
I have a specific scenario as while the main job started a table should get inserted with the jobstart time and when the main job finished the same table should be updated with jobend time.How could i go ahead with this.
Thanks in advance.

Regards,
rajii

Posted: Tue Feb 15, 2005 9:52 pm
by kcbland
Write your own jobcontrol with the required functionality.

Posted: Tue Feb 15, 2005 9:53 pm
by kduke
You want it at the start of a job then viewtopic.php?t=91146&highlight= link will get you close.

Posted: Tue Feb 15, 2005 10:00 pm
by rajiivnb
Hi Kenneth,
Is that possible to insert and update the same table while in job control program.I have very less knowledge in writing job control program please breif it.

Regards,
Rajii

Posted: Tue Feb 15, 2005 10:14 pm
by kcbland
You can create a simple BATCH job that does what you need. Here's some pseudo-code:

1. Use the DSExecute API to run a DOS command line .bat file that executes a database command line shell (isql, dbaccess, sqlplus) running either a SQL script or stored procedure to create your insert row.
2. Use the DS job control APIs (search this forum, read your manuals) to start your desired job and wait for it to finish.
3. Use the DSExecute API to run a DOS command line .bat file that executes a database command line shell (isql, dbaccess, sqlplus) running either a SQL script or stored procedure to create your update row, giving it the result status of the job and setting the end time.

Now, you could take this logic and put it all into a single DS BASIC function, and use that function in a Sequencer to organize a bunch of jobs for your jobstream. Instead of a job activity icon, use a function stage to run your function, which is a better "job activity" activity stage. Consider further expanding your function to fetch job parameters dynamically at runtime and set them in the job. There's a lot you can do.

Posted: Tue Feb 15, 2005 10:21 pm
by ray.wurlod
You could even create little
DataStage jobs to insert/update the table, and have them run from before/after subroutines or, indeed, from a master job sequence. This may be easier for you to maintain.

Posted: Tue Feb 15, 2005 10:30 pm
by rajiivnb
Hi ,
Thanks everyone as i have got different types of solution to move about .

Regards,
Rajii