How to capture the return value from a 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
jpradeep.net
Participant
Posts: 21
Joined: Mon Jul 12, 2010 2:05 am
Location: India

How to capture the return value from a routine

Post by jpradeep.net »

I have a server routine which is using in a job sequence, I want to capture the return value from the routine and save it in a textfile.
ReconLinkCount(jobname,stagename,linkname)

#include DSINCLUDE JOBCONTROL.H

Ans = 0
ThisJob = jobname
ThisStage = stagename
ThisLink = linkname
JobHandle = DSAttachJob(ThisJob, DSJ.ERRFATAL)
Result = DSGetLinkInfo (JobHandle, ThisStage, ThisLink, DSJ.LINKROWCOUNT)
Nothing = DSDetachJob(JobHandle)
Ans = Result
Return(Ans)

I am passing three values to the routine i.e jobname,stagename and linkname. The routine is returing a value. How to capture and store the return value in a textfile.?
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

I believe the commands you need to look at are OPENSEQ to open a sequential file, WRITESEQ to write to a sequential file and CLOSESEQ to close a sequential file.

The InfoSphere DataStage BASIC Reference Guide (and all other release 8.5 manuals) are downloadable from this link for free:

http://www-01.ibm.com/support/docview.w ... wg27008803
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use an Execute Command activity downstream of the Routine activity.

In the Execute Command activity execute a command that will write the routine output - captured from the $ReturnValue activity variable - into the file. One easy way is an echo command with > or >> redirection as appropriate.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply