Page 1 of 1

Questions about subroutine

Posted: Thu Feb 12, 2004 2:04 pm
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

Posted: Thu Feb 12, 2004 2:08 pm
by kcbland
Subroutines are called:

Code: Select all

CALL DSU.yourroutinename(InputArg, ErrorCode)

Posted: Thu Feb 12, 2004 2:30 pm
by yiminghu
Thanks, it works. Greatly appreciated.

One more question

Posted: Thu Feb 12, 2004 3:05 pm
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,

Posted: Thu Feb 12, 2004 3:11 pm
by kcbland
Put this at the top of your routine:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

Posted: Thu Feb 12, 2004 3:29 pm
by chulett
Hmmm... hmmm... hmmm... patiently waits for Ray to whack Ken with the same stick he whacked me with [taps foot]

:lol:

Posted: Thu Feb 12, 2004 3:32 pm
by yiminghu
Ken,

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

Yiming

Posted: Thu Feb 12, 2004 3:45 pm
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

Posted: Thu Feb 12, 2004 4:38 pm
by kcbland
yeah yeah yeah

Ray's right, of course.