Questions about subroutine

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
yiminghu
Participant
Posts: 91
Joined: Fri Nov 14, 2003 10:09 am

Questions about subroutine

Post by yiminghu »

Hi,

I was trying to write a my own subroutine to be called in the job control. I was able to create the routine sucessfully. But when I tried to call the routine in the job control, it did not pass the compilation. It mistakes routine name as array name.

Here is the defintion of my routine:
Subroutine RunDW(InpurArg,ErrorCode)
Call DSLogInfo("The subroutine is called",InputArg)
ErrorCode = 0;
Return

And my code to call the routine is
error = RunDW("Test")

Can anybody shed some lights?

Thanks,

Carol
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Subroutines are called:

Code: Select all

CALL DSU.yourroutinename(InputArg, ErrorCode)
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
yiminghu
Participant
Posts: 91
Joined: Fri Nov 14, 2003 10:09 am

Post by yiminghu »

Thanks, it works. Greatly appreciated.
yiminghu
Participant
Posts: 91
Joined: Fri Nov 14, 2003 10:09 am

One more question

Post by yiminghu »

Hi

I was trying to write a subroutine, the subroutine is going to execute a job, the job name would be passed through InputArg. But I had difficulty compiling this subroutine, it keeps saying DSAttachJob never dimensioned etc.

I don't understand why? And any solutions to that problem?

thanks,
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Put this at the top of your routine:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... hmmm... hmmm... patiently waits for Ray to whack Ken with the same stick he whacked me with [taps foot]

:lol:
-craig

"You can never have too many knives" -- Logan Nine Fingers
yiminghu
Participant
Posts: 91
Joined: Fri Nov 14, 2003 10:09 am

Post by yiminghu »

Ken,

Thanks a lot for your quick response and superior knowledge. I am really impressed.

Yiming
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

chulett wrote:Hmmm... hmmm... hmmm... patiently waits for Ray to whack Ken with the same stick he whacked me with [taps foot]

:lol:
One can get away without bullet-proofing routines, because JOBCONTROL.H is never (up to version 7.0 anyway) automatically defined/included in user-written Routines.
I still put the check in anyway - you never know what "they" might do in a later version.

Code: Select all

* Include JOBCONTROL.H lines unless already included
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

yeah yeah yeah

Ray's right, of course.
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
Post Reply