Page 3 of 3

Posted: Tue Jan 30, 2007 3:43 pm
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.

Posted: Tue Jan 30, 2007 3:46 pm
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.

Posted: Tue Jan 30, 2007 3:48 pm
by splayer
Ray, thank you very much. That explains it very clearly.

Posted: Tue Jan 30, 2007 3:50 pm
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]

Posted: Tue Jan 30, 2007 6:11 pm
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).