how to use routine?

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

Moderators: chulett, rschirm, roy

Post Reply
qutesanju
Participant
Posts: 373
Joined: Tue Aug 26, 2008 4:52 am

how to use routine?

Post by qutesanju »

I have written a routine
to get records passed from that stage
for auditing purpose,but how can use this routine?

I know in master SEQ i can call the routine,but not exactly sure where and how to use this routine?

My requirement is to write a routine and get count ,Write counts to a seq/flatfile

routine is as below

$INCLUDE DSINCLUDE JOBCONTROL.H

Equate RoutineName to 'StageRowCount'
Handle = DSAttachJob ("JobName", DSJ.ERRNONE)
Count = DSGetLinkInfo(Handle, "StageName", "LinkName", DSJ.LINKROWCOUNT)
Ans = Count
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

you can include it either in a routine activity stage ( use custom trigger in the activity o/p link) or , what may work better is to use an user variables activity - In case you need to pass the output of this routine to another downstream activity .
qutesanju
Participant
Posts: 373
Joined: Tue Aug 26, 2008 4:52 am

Post by qutesanju »

I know I can access routine into seq job at the end using routine activity.

but how to modify it to write the counts into a file?
I'm newbie for routine ,so not sure how to call and use routine
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: how to use routine?

Post by SURA »

qutesanju wrote:My requirement is to write a routine and get count ,Write counts to a seq/flatfile
1. To know how many records to that file alone?

If you use the link to get the counts may not be correct all the times. If the records got rejected due to any reasons may not be reflect in the link.

Rather than that, you can use a wc -l kind of OS command to get the number of records in the file.

Code: Select all

FileName ="FILEPATH"
CMD = "wc -l" : FileName : " > filename.txt"
Command = CMD
SystemReturnCode = 0
Call DSExecute (Shell, Command, Output, SystemReturnCode)
I havent tested this code as i typed in notepad.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Post Reply