Routine to compile a job

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
JP
Participant
Posts: 11
Joined: Wed Oct 26, 2005 7:04 am
Location: Luxembourg

Routine to compile a job

Post by JP »

Hello,

I am new to DS Server and I would like to know if it exists a routine only to compile a job ?

something like the routine UtilityRunJob but just to compile (I can't validate it because of 'dynamic' parameters (with sql))

to explain: my problem is that i run many times (in a sequence) a job which runs others jobs without compiling. But when it aborts once, all the next call abort because it is not in a right state.

Somebody could help me?

thanks for your help
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Re: Routine to compile a job

Post by loveojha2 »

When you call a job from a sequence through the job activity, their is an option in the job activity Execution Action, whose value is set to Run default, change it to Reset if required, then run. This should solve your requirement.

Thanks
Success consists of getting up just one more time than you fall.
JP
Participant
Posts: 11
Joined: Wed Oct 26, 2005 7:04 am
Location: Luxembourg

Post by JP »

I think I don't have well explained it.

I must use a job which calls others jobs with the routine
UtilityRunJob(jobname, jobparameters, row limit, warning limit)
but this routine doesn't do 'the reset if required then run' so it couldn't run the jobs in aborted state.

I would like (if i can :) ) use a routine to compile this job jobname before?


ps:this job is very complex and i wouldn't have to transform it into a sequence.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no routine for compiling a job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You don't need to recompile a routine in order to make it running from a job or a sequence. If you have issued a call to DSAttachJob() somewhere in your process then you can issue a command

Code: Select all

JobHandle = DSPrepareJob(JobHandle)
and it will reset an aborted job prior to running.
JP
Participant
Posts: 11
Joined: Wed Oct 26, 2005 7:04 am
Location: Luxembourg

Post by JP »

ray.wurlod wrote:There is no routine for compiling a job.
ok thanks, that's what I was affraid of.

There is really no way ?? :?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You should never need to "compile" a job automatically, because there is no way that a job can become uncompiled once it has been compiled.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JP
Participant
Posts: 11
Joined: Wed Oct 26, 2005 7:04 am
Location: Luxembourg

Post by JP »

Yes, I'am ok with you.

but the job called could become 'aborted' and unfortunately I couln't run it again from the routine RunJob without doing manually a compilation or doing something like 'reset before run'

bad news :cry:
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Hi,

Modify UtlityRunJob( ) routine use DSGetJobInfo to get the status of job if aborted then use DSJ.RUNRESET in DSRunJob else DSJ.RUNNORMAL.....


Thanks,
Anupam
JP
Participant
Posts: 11
Joined: Wed Oct 26, 2005 7:04 am
Location: Luxembourg

Post by JP »

Thanks Anupam, I'll try it!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

sb_akarmarkar wrote:...if aborted then use DSJ.RUNRESET in DSRunJob else DSJ.RUNNORMAL
Small correction. If aborted, then you would need to do the reset run then the normal run. It's 'and' not 'else'. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
JP
Participant
Posts: 11
Joined: Wed Oct 26, 2005 7:04 am
Location: Luxembourg

Post by JP »

thanks very much :D

now it is ok! I've created a small routine for it, which reset if necessary.

Code: Select all

*************************************************************************
* Copyright (C) 2004, 1997-2003 Ascential Software Corporation. ALL Rights Reserved. *
* This code may be copied ON condition that this copyright              *
* notice IS included AS IS IN ANY code derived FROM this source.        *
*************************************************************************
*
* Demonstrate how TO RESET a job within the GUI development enviroment. 
*

$INCLUDE DSINCLUDE JOBCONTROL.H

    Equate RunJobName TO Arg1

    JobHandle = ''
    Info = ''
    ErrCode='No reset required'

    JobHandle = DSAttachJob(RunJobName, DSJ.ERRFATAL)
	 
 *   Call DSLogInfo(Message, RoutineName)
 *  LimitErr = DSSetJobLimit(JobHandle, DSJ.LIMITROWS, RowLimit)
 * LimitErr = DSSetJobLimit(JobHandle, DSJ.LIMITWARN, WarnLimit)
   
* get status

    Status = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)
    IF (Status = DSJS.RUNFAILED OR   Status = DSJS.RUNWARN) THEN
   	   ErrCode = DSRunJob(JobHandle, DSJ.RUNRESET)
         ErrCode = DSWaitForJob(JobHandle)
	   Call DSLogWarn(Message, RoutineName)
    END
	
	Ans=ErrCode
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Good start. A couple of points, qualified by the fact that this is all off the top of my head.

1) No need to reset for a RUNWARN. Probably better to check for the ones you don't need to reset and do it for any other code. Jobs do fail in more ways than just by Aborting, ya know.

2) You should check to see if the DSAttachJob succeeded.

3) Why log a warning when resetting?

4) Where is 'Message' defined? 'RoutineName'? I don't recall the 'routine name' being set automagically. Where is 'Info' used?

5) Once complete, use DSDetachJob to release the handle.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply