GetLinkCount error.

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

Post Reply
efxuser
Premium Member
Premium Member
Posts: 50
Joined: Tue Jun 24, 2008 9:00 am

GetLinkCount error.

Post by efxuser »

Iam planning to use this in the end of a sequence to fetch counts from both parallel as well as server jobs.Am i on the right track?

FUNCTION GetLinkCount(JobName, StageName, LinkName)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

hJob = DSAttachJob((JobName), DSJ.ERRNONE)
Name = DSGetJobInfo(hJob, DSJ.JOBNAME)
If Name Matches "'-'1N0N"
Then
Ans = "Failed to attach job " : Quote(JobName)
End
Else
Temp = DSGetLinkInfo(hJob, StageName, LinkName, DSJ.LINKROWCOUNT)
Begin Case
Case Temp = DSJE.NOERROR
Ans = Temp
Case Temp = DSJE.BADSTAGE
Ans = "Stage name " : Quote(StageName) : " not found in job."
Case Temp = DSJE.BADLINK
Ans = "Link name " : Quote(LinkName) : " not found in job."
Case @TRUE
Ans = "Error encountered in DSGetLinkInfo. Code " : Temp
End Case
ErrCode = DSDetachJob(hJob)
End
RETURN(Ans)


I tried to test this routine directly using the Test boutine in server routine tab.I pass the name of the job,transformer name and link from the transformer to oracle stage

I get the output as
TEST #1
*******

Arg1 = Job_pre_app_fin
Arg2 = Transformer_51
Arg3 = DSLink52

Test completed.


Result = Error encountered in DSGetLinkInfo. Code 50

I cannot find this code anywhere?any ideas/ help?
EFX
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You need logic to make sure hJob is attached.
Mamu Kim
efxuser
Premium Member
Premium Member
Posts: 50
Joined: Tue Jun 24, 2008 9:00 am

Post by efxuser »

I do have this part in my code...right...is this what u meant or is there something else?hJob = DSAttachJob((JobName), DSJ.ERRNONE)
Name = DSGetJobInfo(hJob, DSJ.JOBNAME)
If Name Matches "'-'1N0N"
Then
Ans = "Failed to attach job " : Quote(JobName)
EFX
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That "50" is your count. Your first 'case' statement needs to be corrected, as you only declare the function call good if it returns a zero:

Case Temp = DSJE.NOERROR
Ans = Temp
-craig

"You can never have too many knives" -- Logan Nine Fingers
efxuser
Premium Member
Premium Member
Posts: 50
Joined: Tue Jun 24, 2008 9:00 am

Post by efxuser »

awesome.that works.thanks much
EFX
Post Reply