Page 1 of 1

Posted: Thu Feb 15, 2007 1:31 pm
by narasimha
Many post have discussed the same, do an exact search on "DSJ.LINKROWCOUNT". If you have any doubts, get back.

Posted: Thu Feb 15, 2007 2:09 pm
by ray.wurlod
However you can not use this server function in a parallel job. The place to use it is either in an after-job subroutine or in a routine invoked from a Routine activity executed after the job in a job sequence. For example an after-job subroutine might have the following code (the file pathname is given in the Input Value field):

Code: Select all

SUBROUTINE AddLinkRowCount(InputArg, ErrorCode)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

ErrorCode = 0 ; * set to non zero value to abort job

RowCount = DSGetLinkInfo(DSJ.ME, "loader", "order_feed", DSJ.LINKROWCOUNT)

Shell = "UNIX"
Command = "echo " : RowCount : " >> " : FilePath
Output = ""
ExitStatus = -999
Call DSExecute(Shell, Command, Output, ExitStatus)

If ExitStatus <> DSJE.NOERROR
Then
   Call DSLogWarn("Error in writing trailer" : @FM : Output, "AddLinkRowCount")
End

RETURN
If you were also to provide the stage name and link name through the Input Value field, you would have a useful re-usable component.

Posted: Thu Feb 15, 2007 8:23 pm
by kumar_s
Alternatively you can use the OS command option.

Code: Select all

dsjob -linkinfo $Project $Job $Stage $Link | grep 'Link Row Count' | awk '{print $5}'`

Re: Row Count

Posted: Fri Feb 16, 2007 12:48 am
by sudeepmantri
Hi, Yup u r right. We can use the DSGetlinkInfo function. U have to associate ur job with an after job subroutine first.

Follow the code snipet

intNoRecInput=DSGetLinkInfo(DSJ.ME,Stage_Input,Link_Input,DSJ.LINKROWCOUNT)

//here the row count on Link_input is stored in variable intNoRecInput


//Now writting the Count to FILE
OpenSeq strFile To objFileVar
Else Create objFileVar Else ErrorCode =1
WeofSeq objFileVar

WriteSeq FMT("Input Record Count : ","30L"):FMT(intNoRecInput, "12'0'R") To objFileVar Then
End
CloseSeq objFileVar

//How to pass stage name and link name to subroutine
//Here stage name is the name from which the link getting originated
//Link name is the name of the link
Stage_Input=Field(InputArg,';',1)
Link_Input=Field(InputArg,';',2)

In the job click on the job property, select the after job sub routine from the drop down box. pass the stage name and link name separated by a ';'
Another ';' after link name (Remeber names are case sensitive).
The count will be written in to File








Thanks in Advance.[/quote]

Posted: Fri Feb 16, 2007 1:35 am
by ray.wurlod
What language is that meant to be? You've mixed DataStage BASIC statements with C++ style comments. The former are not available in parallel routines.

Posted: Fri Feb 16, 2007 4:17 am
by kumar_s
If "/" is used for commenting, "*" can be used.