Page 2 of 2

Posted: Wed Aug 22, 2007 10:28 pm
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

Posted: Wed Aug 22, 2007 10:42 pm
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'

Posted: Wed Aug 22, 2007 10:52 pm
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.

Posted: Wed Aug 22, 2007 11:06 pm
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.

Posted: Wed Aug 22, 2007 11:23 pm
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.

Posted: Wed Aug 22, 2007 11:31 pm
by chulett
Why a UserVariables stage? Are you planning on driving a Loop? Use a Routine Activity stage and conditional triggers for this task.

Posted: Thu Aug 23, 2007 12:24 am
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

Posted: Thu Aug 23, 2007 12:12 pm
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...