custom in job activity (sequence)

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

custom in job activity (sequence)

Post by rajan.n »

Hi all.

we are having a custom option in the job activity/trigger in the sequence job
if anybody let me know the use of this i willl be very thank full to them.
also if they provide any documentation on this.
Thanks much in advance
rajan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

A 'custom' trigger? That just means you provide the entire trigger expression, like 'A = B' or 'Stage.$JobStatus = DSJE.RANOK' or some such. Documented in the Help.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

hey chulett thanx a lot, this was giving me some picture abt its usage.
i have an issue..
i have a file generated by a job in a sequence.(job activity).so in that file there is a field rowcount. so if the row count > 0 .ex: rowcount is 0 nothgn..if 1 or 2 ..3..then .next step is to send a mail notification ,else nothng..
so my question is can we use ..this custom triger..? or any other sol for this in the job activity..??
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Typically one would write a custom routine to get the row count - either via a DSGetLinkInfo call or a check of the output file itself. You can then pass that row count back from the routine and use the value in a trigger:

Code: Select all

StageName.$ReturnValue > 0
Would be one approach.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Hi chulett,
thanx a lot for ur responce..
this rowcount is a field which is not generated dynemically its the value comming from the source table.
my req wud be to know the value in the rowcount and generate teh expression , can we do this inthe sequence ? with custom trigger.
ur responce is giving me much knowledge
thanks for the same.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then a DataStage job to read the value from the source table and stash it somewhere. The Sequence should then be able to retrieve that value and make decisions from it.

Search the forum for USERSTATUS or better yet DSSetUserStatus for one way to rather easily do the 'stashing' and retrieval of that value. Or if you prefer, write it to a flat file. A routine could be created to read the file or simply 'cat' it to capture the value.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Hi thanx a lot chulett this shud make me close to solution.
let me exlain in clear..
am having a job wich retrives some fields from a table in that one is "rowcount" that job will store all the data in to a flat file ,my req is if tht rowcount has 0 no issues if it has >0 then need to have notification mail.
i have a sequence which runs this job , so after runign this job, i wud like to know wether "rowcount" holds 0 or >0 ,can u tell me now how to deal this..
i got to know from the serch that i can not call the routine from any transformer since am in parellel ex. if i have to write a code( routine ) after sub routine may hlp me.. can u hlp me how to extract the rowcount value and create a userstatus..
thanks a lot chullet.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Did you search for DSSetUserStatus? Did you find any posts like this one? There are more, but it explains the basic mechanism.

In your job that writes the row count to a flat file, also use the routine mentioned in the post to push the Row Count to user status. Then you can pick it up automatically in a Sequence job using StageName.$UserStatus in a trigger or in the Nested Condition stage. Note that the job will need to either be a Server job (which is fine for a 'retrieval' job like that) or via the BASIC Transformer.

Or as noted before, write a Routine that reads the flat file and sends the Row Count back as the 'answer'. Then again use the $ReturnValue in your Sequence job to decide if to send email or not.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Hi chullet,
really thanx a lot for ur guidence.
as u said , now am having basic transformer.
1) i created a routine(transformer)
Rowcount(arg)
Call DSSetUserStatus(Arg1)
Ans = 0

2) in the Basic transformer
used a stage variable 'userstatus' and called the above routine as below.
Rowcount(Read1.REJ_ROW_CNT)
where the Read1.REJ_ROW_CNT is the input column from source.

3) in the sequence...
and in the jobactivity, used triger UserStatus -(conditional)
in that gave as BASIC_Transformer_169.$userstatus >0

i guess i hve made some thing wrong or missing some process in middle.
my sequence didnt get compiled and waring reads."WARNING: Variable 'BASIC_Transformer_169.$userstatus' never assigned a value."


and at the last, i found some thing in search can u pls see this....
viewtopic.php?t=95608&highlight=dssetuserstatus

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

Post by chulett »

Well, that post you linked to seems to indicate that you can't do the User Status thing in a Parallel job. If that is true then you'll need to do what both of us suggested and make this one job a Server job. But that doesn't explain your Sequence problem.

Many things in DataStage are case sensitive. When I wrote that you could use $UserStatus in a trigger I meant exactly that - not $userstatus or any other variation. Try correcting the case and see if that helps. And make sure the stage name exactly matches as well!
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Hi Chullet ,
thnx a lot.
i tried giving $UserStatus but dint not worked ,got the same warning. i gave $userstatus because the stage variable name i have given is userstatus.
is there any process am missing.
how the sequence will identify this userstatus..?? do i need to pass this variable as a parameter..??
jst confused with this.
again thanking u for ur responce.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? Ok... the name of the stage variable doesn't matter. The name of the transformer doesn't matter. What you need to use in the custom trigger expression is again exactly what I wrote - but perhaps more specifics are needed. In the trigger, use:

Code: Select all

JobActivityStageName.$UserStatus
Replace JobActivityStageName with the actual name of the Job Activity stage in the Sequence job that runs your 'fetch into user status' job.
-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 »

What do you mean by "stage variable" here? There's no such thing in a job sequence. Do you mean "job parameter"? "Job sequence parameter"? "User variable"?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

yes, this alowed me to compile. and sequence is finished.
but i have given a condition like if the value is >0 then send the mail notification. how can i know what is the value in the userstatus..?? is there any method to see the value.
thanks a lot chullet. am happy that am very near to the solution.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You don't know how happy I am, too. :wink:

One way would be to add a call to DSLogInfo in your User Status routine, then the value will be in the Sequence job's log after it finishes.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply