How can i do "Clear Status File" in my jobcontroll

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
MAT
Participant
Posts: 65
Joined: Wed Mar 05, 2003 8:44 am
Location: Montréal, Canada

Post by MAT »

Hi,

If you are designing your job control with a job sequencer, you can use the option: Reset if required, then run under execution action in your job activities.
Otherwise, using a routine, you can call a jobrun with a reset option:

ErrCode = DSRunJob("JobHandle", DSJ.RUNRESET )

Your job will return to its previous state in both cases.

Hope this helps

MAT
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You do not, ever, clear the status file under program control.
The utility in the Director called "Clear Status File" does not actually clear it entirely; a number of control records must be preserved.
Resetting the job is sufficient, as Mat pointed out.
If you want to see code to do that, create a job sequence with a job activity for which the execution action is "reset if required, then run". Compile the job sequence then inspect the job control code that has been produced. You will see that this uses a call to the DSPrepareJob() function.
If you are using a version of DataStage earlier than 5.0, you do not have access to job sequence functionality, and would have to code it yourself. The algorithm:
(1) tests whether the job needs to be reset
(2) if so, runs the job in reset mode
(3) detaches and re-attaches the job (avoids job-locked)
(4) if reset was successful runs the job in normal mode

Creation of this kind of code (and other techniques for writing "bullet proof" job control code) is taught in Ascential's "Programming with DataStage BASIC" class.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
ariear
Participant
Posts: 237
Joined: Thu Dec 26, 2002 2:19 pm

Post by ariear »

Hi ALL,

I'm using DS6 and after a HARD RESET while a job was running it remains with running status as you all know, However it cannot be RESET using Director
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You've now reached the point where Clear Status File is probably the only way out of your dilemma. Though even that may be over the top.
Were I advising you professionally, I would counsel using Director to implement this function.

While clearing the status file can be done from TCL, you have to ascertain the job number, and a mistake can negatively impact other jobs in the project.

Someone else may post that you can use the CLEAR.FILE command at TCL. While this is true, there are even dangers here if you are using multi-instance jobs or parallel jobs. You need to be really careful; the correct mechanism is to identify the record(s) in RT_STATUSxx relating to the particular wave, and either reset the status column in these or delete just these.

Metadata for the Repository tables, such as RT_STATUSxx, are not in the public domain. So you don't (can't) know, for example, which column is the status column.
Unless you're a comptent UniVerse file hacker, of course. [8D]
Post Reply