Code: Select all
Random>9999,var1
Let>var1=var1
VBSTART
VBEND
Let>DecVal=%var1%
VBEval>Hex(%DecVal%),HexVal1
Random>99,var2
Let>var2=var2
VBSTART
VBEND
Let>DecVal=%var2%
VBEval>Hex(%DecVal%),HexVal2
Random>9,var3
Let>var3=var3
VBSTART
VBEND
Let>DecVal=%var3%
VBEval>Hex(%DecVal%),HexVal3
Let>WLN_NOCRLF=0
WriteLn>C:\randomstr.txt,nWLNRes,;A1%Hexval1%A2%hexval2%A3%hexval3%
I, and SQL need the string to be ;A1#####A2#####A3###. As you have probably guessed, the A1,A2,and A3 characters are field identifiers that are required for SQL. The bytes immediately after these identifiers are the data (in Hexadecimal notation).
I need to add leading zero's to each data field so that the field complies with a specialized validation procedure we have. This is not as easy as it looks (i think). It is impossible to just add zero's to the string because of the Random numbers and the subsequent hex conversion.
Is it possible to code an "IF" statement to accomplish the correct format? Something like...IF the hex value is less than 5 characters long, THEN fill with "leading" Zero's from the left till there are five characters exactly.
I don't know where to begin.
I hope someone understands what I'm looking for javascript:emoticon(':?')
Thanks in advance,
Mba.