Sub routine

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
bikan
Premium Member
Premium Member
Posts: 128
Joined: Thu Jun 08, 2006 5:27 am

Sub routine

Post by bikan »

Hi ,

Can any one tell me the meaning of !, <-1> & <1> in the following :


Cmd = "db2 connect to ": PServer : " user " : USERDB : " using " : DADASS

Call DSExecute("UNIX",Cmd,Output,Status)
Call DSU.Jobharieadh(REST,Output)
!Ans<-1> = Cmd

If Status<1> = 0 Then Ans = @TRUE


PS: is '!' equivalent to OR or NOT[/b]
Last edited by bikan on Thu Aug 14, 2008 4:06 am, edited 1 time in total.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Bikan - you really should know better than to use "urgent" in your message and expect a response. Invariably the frequent posters will ignore posts marked "urgent" for a while. Ray will certainly add his comments regarding the true cost of urgent and immediate support.

This is exacerbated by the fact that your question is answered by looking into the documentation, and you consider it faster and easier to post here instead of reading the file on your PC so I am not particularly inclined to respond.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well, now that I'm up from sleepy time...

:? This is oddly coded as I don't know why one would treat 'Ans' as a dynamic array for no good reason, which is what the angle brackets are doing: they denote the element of the array to access. So <1> means the first element and <-1> is special magic to mean "push this to the next available element".

And a bang (!) means 'not' in an expression but used there at the beginning of an assignment line? I'm guessing they think it makes the line a comment. I know '*' does but have never seen '!' used that way that I recall. :?
Last edited by chulett on Thu Aug 14, 2008 3:48 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Yes, the "!" at the beginning of the line means that it is a comment.

"IF Status<1> = 0" means the first field of the Status variable, this comes back as one field only so is equivalent to "IF Status = 0" in this case.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Assumed so, thanks for the confirmation.

Output is a dynamic array here, not Ans or Status, which is why I found this syntax odd. Technically it works cuz DataStage is smarter than us but tells me the coder didn't really understand what they were doing. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"#" does NOT introduce a comment in DataStage BASIC.

Looks like the dynamic array was being passed back while testing, since this line is now commented out.

I often pass dynamic arrays - it's a more convenient mechanism than most others that are available.

The -1 syntax in dynamic array assignment means "append a new element"; in this particular case, since the -1 appears at the field position in the reference, it means to append a new field. For this to work properly, the dynamic array (Ans in this case) must already exist (have been assigned a value), even if it's Ans = "", which this code lacks.
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 »

Early. Misremembered. Edited.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply