row count

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

row count

Post by rsunny »

Hi ,

I have to find the row count in my scenario and i am using DSGETLINKINFO and i m giving the stage name, link name and the DSJ.LINKROWCOUNT for row count , but i am getting the ersult with 1 row less. i mean if the row count is 5 , when i use the function , it is giving me 4 i.e. one value less than the actual value.Can any one tell me what might be the issue and how to solve the problem. i can do it through aggregator but i vae to find conuts for 3 links and i have to use again e aggregators as there are three different conditions .


Thanks in advance
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Where are you using the function to get link count. It is to be used in after job subroutine or maybe in a different job using job and link name(s) of this job.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi ,

i am using within the job giving the stage name , link name and owcount function.

Thanks in advance
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

So you will only get what has gone out so far. I would ask you to add one to the link count but thats unchartered waters as you have constraints so the best way is to use it in an after job subroutine or another job.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi ,

I dont have any idea of how to use it after job subroutine.I men how to use that function in after job subroutine and can you please explain me how to use that function in afte job subroutine as do i need to use a routine to use it in after job subroutine. Can anyone please explain me how to use it in after job subroutine

thanks in advance
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Write it as an after-job subroutine rather than as a transform function. That is, change the routine type.

This will destroy your source code, so make sure you've preserved that first.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi Ray ,

So do i need to use a routine to get the row count and use that routine in after job subroutine in job properties. Can you what is the after job subroutine type do i need to use as there are different types.

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

Post by chulett »

Sorry, but isn't the answer pretty obvious from their names? :?
-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 »

When you create a server routine one of the first things you do is to specify its routine type on the General tab.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi Ray ,

Thanks for your help by giving a reply but i was trying to find the row count without using any routines and using the DSLINKGETINFO function in one of the stages in the job. i can able to get the row count but sometimes if i get the row count as 5 it displays as 4 and sometimes it is giving corect row count

And i tried using After job subroutine giving input values as transformer,Insert,
and the code used is

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

      If count(InputArg,',') <> 2
      Then
         k = 2
         goto ErrorExit
      End
      Else
         StageName = field(InputArg,",",1)
         LinkName = field(InputArg,",",2) 
          x=""
End
JobHandle=DSJ.ME

Insert=DSGetLinkInfo(JobHandle,StageName,LinkName,DSJ.LINKROWCOUNT)

x="Reject Count = " : Insert
ErrorCode = 0 

ErrorExit:
      ErrorCode = k


I got the following error 'Error variable unassigned on return from AFTER routine DSU.Count'

Any help is really appreciated.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The error message is because the variable called k is not set in every path through the code, and has not been given an initial value. Before/after subroutines only ever have two arguments; this is not something that you need to check.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I'd also suggest a more descriptive routine name than simply "Count".
-craig

"You can never have too many knives" -- Logan Nine Fingers
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi ray,

i tried to remodify the code

ErrorCode = 0 ;* set this to non-zero to stop the stage/job
$INCLUDE DSINCLUDE JOBCONTROL.H


StageName = field(InputArg,",",1)
LinkName = field(InputArg,",",2)


JobHandle=DSJ.ME

Insert_Count=DSGetLinkInfo(JobHandle,StageName,LinkName,DSJ.LINKROWCOUNT)

x="Reject Count = " : Insert_Count

and when i run the job it ran with no errors but where do i view the output . i mean where is the output i can see for the after job subroutine.

craig - i will definitely give more descritive routine name as of now i am testing it so i used that name.

Any help is really appreciated

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

Post by chulett »

There is no output as you haven't coded any in. What exactly do you want to do with this count? Perhaps USERSTATUS would work for you?
-craig

"You can never have too many knives" -- Logan Nine Fingers
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi craig ,

I have to find the row count and insert the row count in the table.And do i need to use the user status at afterjob subroutine. i mean like where do i use the user status and i created a routine and using the userstatus for another condition in the same job. So can i use the same routine for the row count also for the same job, as i am already using the userstatususing DSSetUserStatus routine in the same job?


Thanks in advance
Post Reply