How should I use the system variables(@User0-@User4)
Moderators: chulett, rschirm, roy
How should I use the system variables(@User0-@User4)
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
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
Re: How should I use the system variables(@User0-@User4)
Actually, what Ray mentioned was the use of @USER0 - @USER4.maximus wrote:Ray had told about the usage of system variables @User0-@User4.So out of curiosity I tried to use them but failed.
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. 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
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 26
- Joined: Fri Feb 27, 2004 7:23 am
- Location: WI, USA
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
*** 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
@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.
Use a hash file to save and retrieve values across jobs or other more complex jobs. Sequential files are also good.
Mamu Kim
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
So can someone clarify as to how I use the variable in the job
Max
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Yes it does.
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.
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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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.
Live and learn.
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.
Live and learn.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 53
- Joined: Wed Nov 05, 2003 8:36 am