Microsoft KB Archive/323281

= &quot;$SET_CHAR Has Invalid Non-Negative Integer Argument&quot; Error Message If You Use a Negative Number with the $set_char Function =

Article ID: 323281

Article Last Modified on 10/30/2006

-

APPLIES TO


 * Microsoft Metadirectory Services 2.1
 * Microsoft Metadirectory Services 2.2 Service Pack 1
 * Microsoft Metadirectory Services 2.2 Service Pack 1

-



This article was previously published under Q323281



SYMPTOMS
If you use a negative number with the $set_char function, you receive the following error message:

19033-ERROR: $SET_CHAR has invalid non-negative integer argument: (-9)

This occurs if you use the $set_char function with the following arguments: $set_char(&quot;~&quot;,&quot;$v_csp&quot;,-9)



CAUSE
The documentation in the Management Agent Toolkit Manual about the $set_char function incorrectly states the following:

Position is one-based, but can be positive or negative. A positive value indicates counting begins at the leftmost character. A negative value indicates that counting begins at the rightmost character.

Both of these statements are incorrect. The base is actually zero (0), and you cannot use negative numbers. In fact, negative numbers generate an error message if they are used. The zero-based nature of the function also precludes the use of negative numbers. $set_char does not modify the buffer in place. This means that you have to assign the result to a variable, which is not stated in the documentation.



MORE INFORMATION
The following sample code demonstrates how the $set_char function works, although the result is actually &quot;AZena&quot;, because the offset at the end of the function call is zero-based: $v_variable = $cd.givenName

IF $EMBEDDED(&quot;Adena&quot;,$v_variable,1) = T

THEN

$mv.zcMisc1 = $SET_CHAR(&quot;Z&quot;,$v_variable,1)

ENDIF

Additional query words: mms zoomit

Keywords: kberrmsg kbprb KB323281

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.