How can I put arguments in a dynamic array?

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
madelong
Participant
Posts: 7
Joined: Thu Nov 13, 2008 3:37 am

Post 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....}
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
madelong
Participant
Posts: 7
Joined: Thu Nov 13, 2008 3:37 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
madelong
Participant
Posts: 7
Joined: Thu Nov 13, 2008 3:37 am

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
mfavero
Premium Member
Premium Member
Posts: 45
Joined: Thu Jan 16, 2003 1:20 pm
Location: Minneapolis

Post 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
Michael Favero

2852 Humboldt Ave So
Minneapolis, MN 55408
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply