After job subroutine not getting called

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
girishoak
Participant
Posts: 65
Joined: Wed Oct 29, 2003 3:54 am

After job subroutine not getting called

Post by girishoak »

HI,

I have created one subroutine I am using as After/Before job subroutine. My routine takes three parameters and processes it. When I created function or routine It worked fine. But when I tried to use as before/after sub routine. It is not getting called. any specific way to call such routine. How to provide parameter (what should be delimeter to provide parameter)

Any changes required in coding.

Please advice

Thanks in advance

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

Post by kcbland »

You go to the job properties and pick your routine from the drop-down list. It would be helpful if you put a message line like:

Code: Select all

CALL DSLogInfo("Beginning YOURROUTINENAME", "Msg")
in your code to show that the routine is beginning, ending, and any other important milestones or messages. I suspect you just don't see it in the job log.
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 »

Before/after subroutines have exactly two arguments.
Therefore you have not created a Routine whose type is "before/after".
Therefore you cannot call it as a before/after subroutine.

The two arguments of a before/after subroutine are InputArg, which is the contents of the Input Value field from the calling job or stage, and ErrorCode, which determines whether the job should be aborted.

The entire contents of the Input Value field (which may include parameter names surrounded by "#") is delivered to the InputArg argument as a string. Your routine needs to parse it.

Before/after subroutines do not appear in the drop down list unless their routine type is "before/after" and unless they have been successfully compiled.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
girishoak
Participant
Posts: 65
Joined: Wed Oct 29, 2003 3:54 am

Post by girishoak »

Hi,

Then how should I use the subroutine I have created. It takes three parameters. Reads filename from first parameter. uses second file to get additional information and creates file with the name of third parameter.

Please guide. can I call this thorugh job control window. If yes, how?

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

Post by ray.wurlod »

What you have created is a transformation function. Check in the routine properties; its type is in the drop-down list.

To invoke a user-written function from DataStage BASIC (whether job control code, before/after subroutine code or even another transform function), you must first declare that function, specifying its number of arguments.

User-written functions are stored in the Repository with a "DSU." prefix.

You can use this name directly, in which case your declaration will appear

Code: Select all

DEFFUN DSU.MyFunction(Arg1, Arg2, Arg3)
and your invocations of that function will appear

Code: Select all

Result = DSU.MyFunction(X, Y, Z)
where X, Y and Z are variables or expressions in the code.

Or you can prefer to use your own name for the function, in which case your declaration will appear

Code: Select all

DEFFUN MyFunction(Arg1, Arg2, Arg3) CALLING "DSU.MyFunction"
and your invocations of that function will appear

Code: Select all

Result = MyFunction(X, Y, Z) 
with X, Y and Z as before.

All of this knowledge already exists in this forum. A search on "calling function" would have found it. Narrowing the search by including the term DEFFUN would have found it more exactly.
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