Page 1 of 1

DS Server Routine which can give information about the link.

Posted: Fri May 11, 2007 12:06 pm
by Minhajuddin
Hi there,
I know that we use DSLinkGetInfor() to get the information about the no. of records sent on a link. But I am unable to write a routine which takes the jobname, stage name and link name as parameters and gives the count of rows as the return value.

Please help me on this.
And thanks a lot..

Posted: Fri May 11, 2007 12:40 pm
by DSguru2B
Use the search facility to get code by others. There are quite a few examples here.
Another place where you can look is, in the source code of the sdk routine, DSRunJob(), under 'Utility'. Look at the section "* Retrieve more information about this job run."

Re: DS Server Routine which can give information about the l

Posted: Fri May 11, 2007 1:06 pm
by chulett
Minhajuddin wrote:But I am unable to write a routine which takes the jobname, stage name and link name as parameters and gives the count of rows as the return value.
And why is that? What have you tried? Why don't you post your current effort here wrapped in

Code: Select all

 tags and we'll help you 'fix' it.  :wink:

Posted: Fri May 11, 2007 4:00 pm
by ray.wurlod
My guess is that the routine lacks DSAttachJob() and DSDetachJob() calls. Probably lacks appropriate error handling also. But let's wait till the first attempt is posted.

Hi I have figured out why it was not working. But, How do we

Posted: Sun May 13, 2007 11:01 pm
by Minhajuddin
Hi there,
Thanks for all your support, I have figured out, what was wrong.
I had given DSJ.LINKROWCOUNT as DSJ.LinkRowCount and that is why it wasn't working. BASIC is case sensitive :wink:

Here is the code of the routine which takes three arguments. The arguments are JobName,StageName,LinkName

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
Job_Handle=DSAttachJob(JobName,DSJ.ERRFATAL)
rc=DSGetLinkInfo(Job_Handle,StageName,LinkName,DSJ.LINKROWCOUNT)
Error_Code=DSDetachJob(Job_Handle)
Ans=rc
Here I have one more thing to do. Instead of returning the value, I think we can write it to a file. But I don't know How to accomplish this. Please Help.

Posted: Sun May 13, 2007 11:06 pm
by ray.wurlod
What kind of file? You can execute the echo command via DSExecute, or go through the more formal OpenSeq, WriteSeq and CloseSeq statements in DataStage BASIC. Search the forum for a useful routine called OpenSequentialFile().

Posted: Sun May 13, 2007 11:12 pm
by nick.bond
In the docs folder of your client install, have a look at the basic.pdf, this can be very useful, particularly in the Quick Reference/Sequential File I/O. This will give you some better ideas about what is available, then you could search the site for the BASIC functions you think you need to use and you'll find examples of others code.