Getting a parameter from a parameter set in a routine

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Getting a parameter from a parameter set in a routine

Post by kurics40 »

Hello,

I have a question about the topic in this thread but it is not clear how it could work. I have a parameter set and I try to get the value of a parameter from it in a routine.

Parameter set name: connection_test
Parameter name: source
Promp: source
Type: string
Default value:
Value: DWH_DEV

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
      nAns = -1
      *myparam = DSAttachJob (connection_test, ErrorMode)
      *Call DSLogInfo("Error mode: " , ErrorMode)

      extracted_source = DSGetParamInfo (DSJ.ME, "connection_test.source", DSJ.PARAMVALUE) 
      
      Call DSLogInfo( extracted_source ,  Ans )
Ans = nAns
I would like to ask kindly a help in this code because I couldnt get it from the description in the other thread.
Thanks,
Janos
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Getting a parameter from a parameter set in a routine

Post by chulett »

kurics40 wrote:Sorry that I hijacked this thread but it is not clear how it could work.
There's a simple solution - don't hijack threads. Start your own thread and link to the other one, something I've done for you here. That way you are in full control of its destiny.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Where is the Ans variable in DSLogInfo() assigned its value?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Post by kurics40 »

ray.wurlod wrote:Where is the Ans variable in DSLogInfo() assigned its value? ...
The Ans variable get -1 value from the begining.
I don't give a serious role of Ans variable.

For testing purpose I tried to print the source parameter in the DS director log to see when it could pick up/assign the correct value from the parameter set.

What can be the right syntax to make this work?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Ans. Not nAns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Post by kurics40 »

ray.wurlod wrote:Ans. Not nAns. ...
Ah. You are right.

Do you have any idea that how can I invoce a variable from a parameter set in a routine?

I am not sure that how can use in this task the DSAttachJob function becasue the parameter set is not a job.

Does anybody have any idea how to make the code work?
jeawin
Participant
Posts: 18
Joined: Mon Oct 04, 2004 6:49 am
Location: Milton Keynes
Contact:

Re: Getting a parameter from a parameter set in a routine

Post by jeawin »

Hi Janos,

I don't think I can help, because I can't see anything wrong with your code. Are you sure the parameter set is set up correctly? Can you see the values in it from a normal DataStage job? What does it say in the log when you execute the routine from a job? Are there any warnings? If it aborts then try and reset it and see if there is a log entry called From Previous Run. If you use the routine test bed and double click on the result does it give you any more information?

Look carefully, there is normally a clue somewhere!

Regards,

Jean
_______________________________________
"If I had asked people what they wanted they would have said faster horses"
Henry Ford
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Is "connection_test" definitely the name of your parameter set (and not the name of the calling job since you tried to attach to it)

Have you got the case correct? Is the parameter set declared in the job calling the routine? Have you corrected your call to DSLogInfo? If DataStage is defaulting Ans to null, you may just be erroring in your output rather than anything else in the code
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Re: Getting a parameter from a parameter set in a routine

Post by kurics40 »

Hi Jean,

Thanks a lot your fast respond. Yes, the script works.
The mistake was that I tried to reach the parameter set from a sequence with an embeded routine inside on that way I didn't add the parameter set to the sequence. I thought It is possible without it.

My purpose is that to write a routine with given parameters which routine can replace a parallel job because it has the same input parameters.

Alternatively I can create another sequence where I include the parameter set and I attach/invoke that sequence from the routine and get the values of them.

Please correct me If I am wrong.

Regards,
Janos
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Post by kurics40 »

Kryt0n wrote:..Is the parameter set declared in the job calling the routine?
Hello Kryt0n,

Do you know a script way to declare the parameter set rather than add it in the host job which call the routine where I want to reach the parameter set?

Best regards,
Janos
kurics40
Premium Member
Premium Member
Posts: 61
Joined: Wed Nov 18, 2009 10:01 am

Post by kurics40 »

Hello All,

I would like to know that how is it possible refere to a parameter set's variables like an independent object and get its values externally eg.: from a routine.

I need this because password encryption option. If it doesnt work I can read it from a file what only dsadm can read but how will I ask the management to deploy it on the PROD....?

Bye,
Janos
Post Reply