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
After job subroutine not getting called
Moderators: chulett, rschirm, roy
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:
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.
Code: Select all
CALL DSLogInfo("Beginning YOURROUTINENAME", "Msg")
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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
and your invocations of that function will appear
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
and your invocations of that function will appear
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.
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)
Code: Select all
Result = DSU.MyFunction(X, Y, Z)
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"
Code: Select all
Result = MyFunction(X, Y, Z)
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.