Row Count

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

Post Reply
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Many post have discussed the same, do an exact search on "DSJ.LINKROWCOUNT". If you have any doubts, get back.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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}'`
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
sudeepmantri
Participant
Posts: 54
Joined: Wed Oct 25, 2006 11:07 pm
Location: Hyderabad

Re: Row Count

Post 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]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If "/" is used for commenting, "*" can be used.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply