Return statement Usage

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
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

Return statement Usage

Post by parvathi »

I have used a code snippet like this:

Code: Select all

Equate TransformName To "rtnXmlChange" 

VarCount = DCount(InitialValue,',')
For i=1 To 2

GoTo Read

Next i

Read:
OpenSeq SourceFile To SrcFileVar
   On Error Call DSLogFatal('Error ' , TransformName ) 
   Locked Call DSLogFatal('Locked ' , TransformName )
Else Call DSLogFatal('Cannot open ' , TransformName ) 

Loop 
While ReadSeq Record From SrcFileVar
NewData=NewData: Char(10) :Record
Repeat

CloseSeq SrcFileVar
Return


Ans = New_Data
I am getting the following warning:

Compiling: Source = 'DSU_BP/DSU.rtnXmlChange', Object = 'DSU_BP.O/DSU.rtnXmlChange'
******?
0054 Return
^
WARNING: no RETURN value specified, null used.

0069 Return
^
WARNING: no RETURN value specified, null used.

Compilation Complete.

I would be happy if you can respond to this as soon as possible.
Thanks in advance
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

Check your spelling

NewData and NEW_DATA is not the same
Wolfgang Hürter
Amsterdam
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

Post by parvathi »

I have checked the spelling but i still get the same error
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

Change your first post with the actual spelling, please.
Wolfgang Hürter
Amsterdam
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I suspect you meant GoSub not GoTo. But there's more problems than that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Delete the line with "Return"
Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Return is a valid statement. It will always give you a warning. It causes all kinds of problems. Try to avoid it. If you want to know how to use it then let us know.
Mamu Kim
parvathi
Participant
Posts: 103
Joined: Wed Jul 05, 2006 4:48 am
Contact:

Post by parvathi »

kduke wrote: If you want to know how to use it then let us know.
Yes i want to know how to use it
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You're in a transformation function. That is your Routine type. I can tell because you are setting a value for Ans.

In a transformation function you must use the Return() function (with a value), not the Return statement (which is used in internal subroutines in before/after subroutines).

You might also ask yourself what happens when your code steps past the Next statement. And what happens the first time the assignment to New_Data is attempted, with New_Data never having been assigned a value.

Why are you opening the same file twice? (You could use Seek statement to reposition to beginning of file.) Why are you reading the same file twice? Wolfgang has already alluded to the fact that variable names are case sensitive.
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