call subroutine in after-job 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
chooi
Participant
Posts: 19
Joined: Wed Jan 26, 2005 8:33 pm

call subroutine in after-job subroutine

Post by chooi »

Hi,
is it possible to call subroutine in after-job subroutine of job properties? how the statement will be?
what option should choose ?
Thanks 1st.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
can you please specify more what it is you want to acomplish?

If you mean simply invoke a DS transform routine the answer is:
Yes, but indirectly - meaning you must build a before/after wrapper routine that runs the ds transform rouine and use it there.

depending on the functionality you want to perform you might need more info.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

chooi,

Usually you will write & wish to call DataStage functions (as opposed to before-after subroutines); they allow you to specify as many parameters as you wish. Before/After subroutines have a defined 2-parameter limit, although you can always put multiple values in the one parameter you do have available.

If you write a function AddMe with 2 parameters, a & b and compile it in the Manager then to use it in a before/after subroutine (or another function) you need to include code such as:

Code: Select all

DEFFUN AddMe(a,b) CALLING 'DSU.AddMe'
a = 3
b = 4
c = AddMe(a,b)
The method for calling a subroutine is similar, only you don't need to tell the compiler to define a function, just call

Code: Select all

DSU.MyBeforeAfterRoutineName(ParameterValue,ReturnCode)
chooi
Participant
Posts: 19
Joined: Wed Jan 26, 2005 8:33 pm

Post by chooi »

Hi ArndW,
what I know is, the job parameter only functioned during run-time . So, after the job runned, job parameter will not abled to "used" in after-job routine. am i right?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, the funny thing is... "after job" is still during the run-time of the job, so job parameters can be used by them. The job hasn't finished running until any after job routines finish as well. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
chooi
Participant
Posts: 19
Joined: Wed Jan 26, 2005 8:33 pm

Post by chooi »

Hi chulett,
how do i put my job parameter inside the input value of "after-job routine"? let say my job parameter is : DATA

so ,is it put like this in input value box:

:DATA:

Plz advice.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Job Parameters are (in almost all cases) enclosed in pound signs or 'hashes' (#) when referenced. The colon is used for concatenation. So, if you simply wanted to refer to a job parameter called DATA, you would do it like this:

Code: Select all

#DATA#
If you wanted to include it as part of a string in a command, then something like this might be in order:

Code: Select all

'Some string ' : #DATA# : ' the rest of the string'
-craig

"You can never have too many knives" -- Logan Nine Fingers
chooi
Participant
Posts: 19
Joined: Wed Jan 26, 2005 8:33 pm

Post by chooi »

Hi chulett,
u r right. job parameter can be used in after-job routine. how about the stage variable? can it be put into after-job routine as well?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No. Stage variables are local variables and don't exist outside of the stage they are defined in.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chooi
Participant
Posts: 19
Joined: Wed Jan 26, 2005 8:33 pm

Post by chooi »

ok .roger that.
Post Reply