Page 1 of 1

Posted: Wed Feb 04, 2009 9:50 am
by chulett
Don't use parens, use angle brackets for the array element. Me, I'd pass in the Args as a delimited string and then use Field() in the loop to get the proper value.

Posted: Wed Feb 04, 2009 9:57 am
by madelong
Thanks !

Do you have an example of the code ?
I don't see how to list my arguments one by one...
cauz now i do :
DIM ParamValue(NbParameters)
ParamValue(1) = arg1
ParamValue(2) = arg2
ParamValue(3) = arg3
...



{sorry for beeing a newbee....}

Posted: Wed Feb 04, 2009 10:26 am
by chulett
OK, let's say your arg list was passed in as a pipe delimited string rather than individual values:

Code: Select all

for i=1 to NbArgument 
  ParamValues<i> = Field(ArgString,"|",i,1)
Next i 
The syntax for all available functions are in the online help.

Posted: Wed Feb 04, 2009 11:26 am
by madelong
Thank you for your time and your answers, i realy apriciate it... But

When i do :

Code: Select all

PARAMS(1) = arg1 
I get in PARAMS(1) the value of the parameter Arg1. (wich i want)

But if i Do

Code: Select all

ArgString = DSGetJobInfo(DSJ.ME, DSJ.PARAMLIST) 
for i=1 To NbArgument ; 
PARAMS(i) = Field(ArgString,",",i,1)
Next i
I get in PARAMS(1) the string "Arg1"... (wich i don't want)

Is there a possibility to get the value of my paramter by browsing a list??

thanks

Posted: Wed Feb 04, 2009 11:44 am
by chulett
:? Where did DSJ.PARAMLIST come from? Read the help - that is a list of the parameter names in the job, not values passed to the routine. My code as posted assumed a single argument passed to the routine with a delimited list of values.

Since your post is now marked as "Resolved" can you please post the resolution?

Posted: Thu Feb 05, 2009 3:47 am
by madelong
I know that DSJ.PARAMLIST returns names... That is my main problem, I need a list of Argument's Values...

So my problem is not resolved yet...

Thank you again.

Posted: Thu Feb 05, 2009 6:38 am
by chulett
Then why is it marked as resolved?

So, are you not passing these values to the routine? Instead, you want to lookup the job parameter values from the job that is calling the routine? That's quite different than what you originally posted. :?

Posted: Thu Feb 05, 2009 11:21 am
by mfavero
OK - first I'll assume you are really using DYNAMIC arrays as suggested before and your code looks like the following. I am usiing [] square brackets because the less than sign and greater than sign don't post

PARAMS = '' ; * this initializes the array variable
ArgString = DSGetJobInfo(DSJ.ME, DSJ.PARAMLIST)
for i=1 To NbArgument ;
PARAMS = Field(ArgString,",",i,1))
Next i

Don't use the DIM function - read about Dynamic arrays

Next you need to get the value for each variable - see DSGetParamInfo in the manual

PARAMVALUES = '' ; * this initializes the array variable
for i=1 To NbArgument ;
PARAMVALUES = DSGetParamInfo(DSJ.ME,PARAMS ,DSJ.PARAMVALUE)
Next i

Posted: Thu Feb 05, 2009 12:22 pm
by ray.wurlod
They do (post correctly) if you wrap them in Code tags!

Code: Select all

PARAMS = '' ; * this initializes the array variable 
ArgString = DSGetJobInfo(DSJ.ME, DSJ.PARAMLIST) 
for i=1 To NbArgument ; 
    PARAMS<i> = Field(ArgString,",",i,1)) 
Next i 

Don't use the DIM function - read about Dynamic arrays 

Next you need to get the value for each variable - see DSGetParamInfo in the manual 

PARAMVALUES = '' ; * this initializes the array variable 
for i=1 To NbArgument ; 
    PARAMVALUES<i> = DSGetParamInfo(DSJ.ME,PARAMS<i> ,DSJ.PARAMVALUE) 
Next i