Surrogate Key using sequence ?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

Field(Execute_Command_2.$CommandOutput,@FM,1)

DSGuru2B, this is from your post earlier in this thread:
"The output is in the form of a dynamic array with other contents in it. They are seperated by a field marker (@FM).
We are only concerned with the contents of the first field. The first code in my previous post extracts everything before
the first @FM. The second code extracts the contents of the first field in the dynammic array. "

For the Field function above, is everything taken from the first element of the dynamic array before the field marker? I am assuming that it is as it is a C array which is actually one contiguous string.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's not a C array. It's a DataStage dynamic array, which is nothing more than a delimited string. The delimiter character is a "field mark" character, which is accessible as the system variable @FM.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

Ray, thank you very much. That explains it very clearly.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

splayer wrote: For the Field function above, is everything taken from the first element of the dynamic array before the field marker? I am assuming that it is as it is a C array which is actually one contiguous string.
It is one contigous string and the field sperator is the @FM as described by Ray.
So
Field(Execute_Command_2.$CommandOutput,@FM,1) is equivalent to
Execute_Command_2.$CommandOutput<1> and in C words, is similar to
Execute_Command_2.$CommandOutput[0]
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Similar, but not the same. C arrays depend on knowing the address in memory of each element. Dynamic arrays are navigated based on the character position in the string with respect to the beginning of the string (which, yes, is a position in memory, but not one that's stored as a pointer anywhere) (unless you're using the Remove or RevRemove statement).
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