inserting rows into a table at runtime

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rajiivnb
Participant
Posts: 77
Joined: Fri Sep 10, 2004 8:38 am
Location: India

inserting rows into a table at runtime

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Write your own jobcontrol with the required functionality.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You want it at the start of a job then viewtopic.php?t=91146&highlight= link will get you close.
Mamu Kim
rajiivnb
Participant
Posts: 77
Joined: Fri Sep 10, 2004 8:38 am
Location: India

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rajiivnb
Participant
Posts: 77
Joined: Fri Sep 10, 2004 8:38 am
Location: India

Post by rajiivnb »

Hi ,
Thanks everyone as i have got different types of solution to move about .

Regards,
Rajii
Post Reply