Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Script - casting

Status
Not open for further replies.

GilMerc

IS-IT--Management
Nov 12, 2003
115
0
0
CA
Hi,

I would like casting a string in a binary value to take an XOR instruction. Somebody know how to do this in macro script.

Thank's in advance,
Gilles.
 
Hi Gilles,

I do not think this is going to be possible with native CognosScript code. To accomplish the converion to binary, you would need to create a byte array. Unfortunately there is no Byte datatype in CognosScript.

Alternatively, you could create a VB COM dll that would perform the conversion for you. If you have VB, let me know and I'll help code a solution.

/R
 
Hi,

First, I found how to do this with CSNG function. the instruction is : csng(asc(char) xor 1 xor number) and it works. I want to read this new result in caracter but it's impossible because the value is now too long.

Second, in vbscript it's impossible to have a string return, it's for this raison I want to do this in cognos script but you said VBcom dll. I don't know how to interface with dll? Could you want to tell me how?

Gilles.
 
Hi Gilles,

I believe you are casting to an ascii character using the asc function rather than to a binary value.

ie:

cslg(asc("A")) = 65 however the binary value of "A" is really 01000001. I suspect you would then want to perform your bitwise operation on the binary value using the xor function(??).

I am not clear as to what you actually need done here. Can you post some example data values?

Thanks,
R
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top