calling routine within a routine

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
dsx_newbie
Participant
Posts: 6
Joined: Thu Jan 04, 2007 3:46 am
Location: Malaysia

calling routine within a routine

Post by dsx_newbie »

Hi to all datastage gurus,

How do you call a routine within a routine in datastage? I am creating a custom routine and wants to use the UtilityHashLookup routine inside my custom routine.

I tried the syntax "Call DSX.UtilityHashLookup("HA_REC_TYPE","2000",2)" but when i compile it's telling me that the routine is expecting 4 arguments but it only has 3 arguments.

Is there any other way to call the subroutine?
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

It's not CALL'ed like a subroutine. Search the forum for DEFFUN to see examples.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

One of the strange things about functions in DataStage BASIC is that they can, indeed, be called as subroutines; the first argument position is reserved for the return value. Therefore the following are equivalent.

Code: Select all

Call DSX.UTILITYHASHLOOKUP(Result,"HA_REC_TYPE","2000",2)

Code: Select all

DEFFUN UtilityHashLookup(Arg1,Arg2,Arg3) Calling "DSX.UTILITYHASHLOOKUP"

Result = UtilityHashLookup("HA_REC_TYPE","2000",2)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

ray.wurlod wrote:

Code: Select all

Call DSX.UTILITYHASHLOOKUP(Result,"HA_REC_TYPE","2000",2)
Hmm. I didnt know a subroutine could be called like that. Thanks for the info Ray.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I trust that everyone noticed that SDK routines are catalogued with a "DSX." prefix (rather than "DSU.") and that the catalog name is all upper case.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What if I want to call a userdefined routine. Can i use the same format with DSU. instead of DSX. ?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yup.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Cool :P
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply