Conditional execution of next job in sequence

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need to include the proper header file:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
Or more properly:

Code: Select all

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
-craig

"You can never have too many knives" -- Logan Nine Fingers
Havoc
Participant
Posts: 110
Joined: Fri Nov 24, 2006 8:26 am

Post by Havoc »

ArndW wrote:I posted a full routine, but you would need to join as a premium member to use it. Lookup up DSAttachJob() in the docs, it has 2 parameters. ...
Yeah I tried the function with the other parameter as well :

New DSAttachJob("Job1",DSJ.ERRNONE)

'New' being the user variable defined in the user variable activity stage. I still get the error message saying

'DSAttachJob not defined'
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

That means that the generated code in a Job Sequence doesn't contain the "INCLUDE DSINCLUDE JOBCONTROL.H" statement, and you won't be able to use these routines. You will have to write a small routine (or get someone to e-mail you the routine listed earlier in this thread) that calls DSAttachJob(), DSGetLinkInfo() and DSDetachJob() to return the row count.

I really think this is a perfect example of how a premium membership pays for itself - think in terms of the time you have spent on this issue and your effective hourly rate.

Or you could try to search for "DSAttachJob DSGetLinkInfo" and you will find at least one thread with DS/BASIC code doing just what you want.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hold on... you're trying to attach to a job, interrogate it for link counts (etc,etc) all in a UserVariables Activity stage expression? :shock:

You'll need to write a routine to do all this and pass your found value back out, then leverage the routine's $ReturnValue there.

Edited to add: Actually, what value is this stage bringing to the table? Unless I'm missing something, it isn't really needed - create the routine mentioned and use a Routine Activity stage to run it. Then conditional triggers from the Routine Activity stage to either run or not run something downstream based on the result.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Havoc
Participant
Posts: 110
Joined: Fri Nov 24, 2006 8:26 am

Post by Havoc »

chulett wrote:Hold on... you're trying to attach to a job, interrogate it for link counts (etc,etc) all in a UserVariables Activity stage expression? :shock:

You'll need to write a routine to do ...
So basically, I have to write a routine with these three function calls and returns the row count ? Call this routine in a user variable activity stage and set the value to a user variable.

Arnd...Yes, I completely agree with you about the premium membership. If I did have one, it would have been tremendous help for a speedy resolution of this problem.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why a UserVariables stage? Are you planning on driving a Loop? Use a Routine Activity stage and conditional triggers for this task.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This is NOT object programming. It is procedural programming.

There is no place for a New declaration in DataStage BASIC.

The correct syntax is:

Code: Select all

hJob = DSAttachJob("MyJobName", DSJ.ERRWARN)
* Test whether attach was successful
Name = DSGetJobInfo(hJob, DSJ.JOBNAME)
If Name = DSJE.BADHANDLE
Then
    Call DSLogWarn("Failed to attach job MyJobName", "MyRoutine")
    Return
End
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Havoc
Participant
Posts: 110
Joined: Fri Nov 24, 2006 8:26 am

Post by Havoc »

Thanks a lot for the suggestions everyone( A shout out to ArndW ;) ). The routine with the User Variables Activity stage idea worked. Thanks...
Post Reply