CrazyBucky:
I have some bad news/good news for you. When I added this suggestion to the Engineering queue, I was informed that TeleFlow already has this functionality. As it turns out, it never got documented
. Therefore, it is the help deficiencies that have been added to queue.
Which means, I can tell you how to achieve what you want to do with the Run BasicScript step. Considering the goose-chase you've been on, I'm going to go into more detail than I usually would. Here's what you need to know.
Firstly, there is an ASC() function. Here's an example of how it works:
Code:
@ASCIIVALUE = ASC(@MYCHAR)
It returns the ASCII value of the first character in a TeleFlow variable (@MYCHAR in the example) into the result variable (@ASCIIVALUE).
Secondly, the BXOR (binary exclusive or) entry in the TeleFlow Help is incorrect. It represents BXOR as a function, but it is, in fact, an operator. To calculate the BXOR of two values, you need to compose your statement like so:
Code:
@RESULT = @VALUE1 BXOR @VALUE2
The two values must be numeric. Non-numeric values are treated as zero.
Lastly, you'll need to get a single character at a time out of your string. You can use the SUBSTR() function for this. It is documented in the help, but I will give you a quick overview:
Code:
@MYCHAR = SUBSTR(@MYSTRING, @POSITION, 1)
Where @MYSTRING is the full string, @POSITION is the character position you want to get, and 1 is to get a single character.
Putting it all together, the following example should work for your XOR checksum script:
Code:
@TOTAL_STRING = "ABCDEFG"
@LENGTH = LEN(@MYSTRING)
@POS = 1
@SINGLE_CHAR = ""
@ASCII_VALUE = 0
@XRESULT = 0
FOR @POS = 1 TO @LENGTH
@SINGLE_CHAR = SUBSTR(@TOTAL_STRING, @POS, 1)
@ASCII_VALUE = ASC(@MYCHAR)
@XRESULT = @XRESULT BXOR @ASC_VALUE
NEXT
You'll have to change it to suit your application, of course.
Important Note: The above code will only work on TeleFlow version 2007.1123 and later.