Page 1 of 1

@FM clarification

Posted: Wed Dec 31, 2014 12:10 am
by vamsi.4a6
In the execute command activity I have seen following trigger condition.
Ereplace(Cmd_CheckRejectSize.$CommandOutput,@FM,'')>0

I want to see the @FM characters using Unix or Note pad++ or any method.Please let me know how to see those characters.I have idea about @FM characters but not sure how to see those characters.Because in many places we are using Ereplace to repalce @FM with '' in my project.I have confusion where to use this Ereplace command to repalce @FM with ''

Posted: Wed Dec 31, 2014 12:20 am
by chulett
You might want to start here.

Posted: Wed Dec 31, 2014 12:51 am
by vamsi.4a6
1)I have read the link mentioned in above post but nowhere it is mentioned how to see those characters because in my project they are using Ereplace function to replace @FM with '' in some places not in all places.Without seeing those characters It is difficult to guess when to use Ereplace function?

Posted: Wed Dec 31, 2014 3:57 am
by priyadarshikunal
@FM is field mark and is not printable, In execute command activity @FM is generally removed from the output.

for this one consider it as a new line removal.

Posted: Wed Dec 31, 2014 7:19 am
by ArndW
The result of the execute command activity is returned as one string. The <CR><LF> represented new lines in the screen output are replaced with the special @FM character in this string. The EREPLACE() function as called will remove all of these characters from the string.

Posted: Wed Dec 31, 2014 7:28 am
by eostic
Think of it as a convenient placeholder and an easy way to perform replacements with a delimeter that wont be confused with any normal characters..... it's been a long time since I dove into their values specifically, but if memory serves, @FM and its counterparts (such as @VM) are high ascii values with decimal values of at or near 253, 254, and 255......... It is very likely still documented somewhere, and I am sure Ray and others can confirm, and you should be able to yourself, using things like iconv to see hex values.....

Either way, it shoukdnt be something to worry about. Just use it consistently......typically with ereplace one of these field marks is used so that later on, or nested, you can use another UV/Basic command that nicely takes advantage of the field mark. UV/Basic is a super powerful language for text string manipulation, and these marks help with that, allowing you to compose (or twist and turn and transform) some pretty sophisticsted structures. You wont often need those levels of sophistication in your normal ds efforts, but when you do.........

Ernie

Posted: Wed Dec 31, 2014 9:10 am
by chulett
Ernie, the values are documented in the link I posted. :wink:

Posted: Wed Dec 31, 2014 10:17 am
by eostic
Thanks Craig. I'm on my phone today and the browser is lame, so I am not able to easily go there, let alone do dsxchange..... : ) Was I close?

Ernie

Posted: Wed Dec 31, 2014 10:28 am
by chulett
Yup! :D

(just don't ask me what exactly each of them are)

@TM A text mark, Char(251)
@SM A subvalue mark, Char(252)
@VM A value mark, Char(253)
@FM A field mark, Char(254)
@IM An item mark, Char(255)

Thought it was kind of obvious that high order values like that weren't really 'displayable' but you could dump the intact values to a file and then use a hex editor or a utility like 'od' to see them, that or go the other direction with the EReplace - for example, change an @FM to the string "@FM" just for educational purposes.

Posted: Wed Dec 31, 2014 10:52 am
by eostic
Thanks Craig. Happy New Year everyone!

Posted: Thu Jan 01, 2015 11:27 pm
by vamsi.4a6
Thanks all for input and just want to know my understanding correct or not.

1)cat temp.txt

1,2
3,4

In notepad++ i can see above file as

1,2CRLF
3,4CRLF

As per ArndW,datastage will replace @FM[CRLF] with ''
when i use Ereplace(Cmd_CheckRejectSize.$CommandOutput,@FM,'').Is my understanding is correct?

Clarifications:

@chulett
1)Why u told me to change an @FM to the string "@FM" just for educational purposes?

As of now i have readonly access to datastage and i can not check this
scenario

2)Let us assume the following below content in notepad++

1,2LF
3,4LF


In the above case will the Ereplace(Cmd_CheckRejectSize.$CommandOutput,@FM,'') function will work?

Posted: Thu Jan 01, 2015 11:43 pm
by chulett
1) As noted, to educate yourself. To make them 'visible'.

As to your other questions, understand that DataStage returns Command Output in a dynamic array with each line sent as output to the screen as an element in that array. The newlines in the output are automatically converted to Field Marks by DataStage. If you are returning a single line of output, you could use that EReplace function to remove the @FM from the end of it. Or sometimes people substring it off. Or you could use array notation so it's not an issue:

Cmd_CheckRejectSize.$CommandOutput<1>

To get only the first array element of the returned output. Also note that this means for multiple line results you could use that notation to iterate through the returned array.

Posted: Fri Jan 02, 2015 12:04 am
by vamsi.4a6
anybody help on my clarifications?

Posted: Fri Jan 02, 2015 12:14 am
by chulett
Did. :?

But just to beat this pony, when you use EReplace() to replace anything with '' (an empty string) you are removing it from the string in question. And yes that includes Field Marks.

Posted: Fri Jan 02, 2015 9:13 am
by chulett
Sorry, just wanted to add that I had hoped you would take the information provided here by folks and apply it to your questions, work things out. This rather than wanting to be spoon fed.

Anywho, see what other questions come to mind now and let us know if you still need help with this.