How should I use the system variables(@User0-@User4)

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
maximus
Participant
Posts: 10
Joined: Wed Mar 03, 2004 5:57 am

How should I use the system variables(@User0-@User4)

Post by maximus »

Hi Pals

Few days back I was going thru a discussion in this forum about returning more than one value from a routine.I used to concatenate those value using a delimiter and use the Field function to get them.

Ray had told about the usage of system variables @User0-@User4.So out of curiosity I tried to use them but failed.I would like to know how to use them coz if I give @User0 in the Derivation it is giving a syntax error.And the list of System variable shows @USERNO.

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

Re: How should I use the system variables(@User0-@User4)

Post by chulett »

maximus wrote:Ray had told about the usage of system variables @User0-@User4.So out of curiosity I tried to use them but failed.
Actually, what Ray mentioned was the use of @USER0 - @USER4.

As with practically All Things DataStage, case is very important. If you literally tried using @User0 and got your error, suggest you go back and try using @USER0 instead. It should work much mo' better. :wink: If it still doesn't, come back and post your exact syntax here so we can take a look at it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
RamonaReed
Participant
Posts: 26
Joined: Fri Feb 27, 2004 7:23 am
Location: WI, USA

Post by RamonaReed »

This is how I used the variables in my Server Routine that Ray had mentioned. I hope it helps you.

*** Arg1
*** Arg2
*** Arg3
*** Arg4
*** Arg5
*** Arg6

*** @USER0 = Returned 1st value
*** @USER1 = Returned 2nd value
*** @USER2 = Returned 3rd value
*** @USER4 = Returned 4th value


nDefault = 1


Begin Case
Case Co = 'X'
@USER0 = 'XYZ'
Case Co = 'Y'
@USER0 = 'YZX'
Case Co = 'Z'
@USER0 = 'ZXY'
Case nDefault
@USER0 = Co
End Case

Begin Case
Case Arg6 = 'IM'
@USER3 = 'XXX'
@USER1 = Arg6
@USER2 = Arg3
Case Arg6 = 'UME'
@USER0 = 'XZY'
@USER1 = Arg6
@USER2 = Arg3
@USER3 = Arg5
Case nDefault
@USER3 = Arg5
@USER1 = Arg6
@USER2 = Arg3
End Case
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

@USER variables are sort of global variables. They only work across one connection. So a complex job may not work across the whole job because the way DataStage works. Named COMMON variables have the same problem. Do a search they have both been discussed in detail. Stage variables are a better solution and are more visible to new developers.

Use a hash file to save and retrieve values across jobs or other more complex jobs. Sequential files are also good.
Mamu Kim
maximus
Participant
Posts: 10
Joined: Wed Mar 03, 2004 5:57 am

Post by maximus »

As far as the routine is concerned there is no problem...The values are getting stored in the variables(@USER0,@USER1,@USER2) properly...how do I use the values in these variable IN MY JOB...ie how do I assign the value stored in the variable @USER0...coz as I said If I use @USER0 in the derivation in the Tranformer...it doesnt accept it

So can someone clarify as to how I use the variable in the job

Max
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes it does. :lol:

Don't be concerned by the fact that the derivation remains red.
All this means is that the system variables @USER0 through @USER4 are not listed in the DSParams file in the project directory on your DataStage server.

The job will still compile and run correctly.

If the red colour really concerns you, edit the DSParams file and put the names of the system variables in there. 8)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Interesting. Up to this point, all I've ever done is use them to "pass" information between coordinated routines, so have yet to stumble across the issue of them staying red in the Transformer. Good to know.

I was concerned that the OP was trying to use them exactly as typed in their message and, while I've never actually tried spelling them in mixed case, figured it could be the source of the problem. DataStage can be so picky about stuff like that at times. :lol:

Live and learn.
-craig

"You can never have too many knives" -- Logan Nine Fingers
maximus
Participant
Posts: 10
Joined: Wed Mar 03, 2004 5:57 am

Post by maximus »

Thanx Ray...So far I have been thinking that if its Red then, it wont compile...thanx for the clarification

Regards
Max
sivatallapaneni
Participant
Posts: 53
Joined: Wed Nov 05, 2003 8:36 am

Post by sivatallapaneni »

Thanx Ray, ur True GURU
I didnt know it works like that till now.

Have a good one.
Post Reply