Page 1 of 1

Getting a parameter from a parameter set in a routine

Posted: Tue Apr 24, 2012 8:39 am
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

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

Posted: Tue Apr 24, 2012 9:26 am
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.

Posted: Tue Apr 24, 2012 3:15 pm
by ray.wurlod
Where is the Ans variable in DSLogInfo() assigned its value?

Posted: Tue Apr 24, 2012 10:57 pm
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?

Posted: Wed Apr 25, 2012 2:37 am
by ray.wurlod
Ans. Not nAns.

Posted: Wed Apr 25, 2012 2:57 am
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?

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

Posted: Wed Apr 25, 2012 11:51 am
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

Posted: Wed Apr 25, 2012 4:18 pm
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

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

Posted: Thu Apr 26, 2012 5:21 am
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

Posted: Thu Apr 26, 2012 5:25 am
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

Posted: Thu Apr 26, 2012 8:20 am
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