David,

First of all, FORMAT() with an integer by default leaves a blank space
at the left end for a "minus sign" for negative numbers.

Secondly, CTXT(FORMAT()) is redundant:  Format already converts the
numeric or date value into text.

Try this:

SET VAR vtesttxt = (FORMAT(.vtestint,'[-]0000'))
SET VAR vwrite = (SPUT(.vwrite,.vtesttxt,2))
SHOW V vwrite

David Poole wrote:
> Dear All
> 
> Version: 7.1.80.30421
> 
> Would someone kindly confirm if there is a boo-boo or am I misunderstanding
> the functions.
> 
> If you run the following:
> 
> SET VAR vtestint INTEGER = NULL
> SET VAR vwrite TEXT = NULL
> SET VAR vtesttxt TEXT =NULL
> 
> SET VAR vtestint = 12
> SET VAR vwrite = 'ABCDEFGHIJ'
> SET VAR vtesttxt = (CTXT(FORMAT(.vtestint,'0000')))
> SET VAR vwrite = (SPUT(.vwrite,.vtesttxt,2))
> 
> The variable values change to:
> 
> vwrite   = A 0012GHIJ  TEXT(10)   
> vtesttxt =  0012       TEXT(5)
> 
> But surely they should be:
> 
> vwrite   = A0012FGHIJ TEXT (10)   
> vtesttxt = 0012       TEXT (4)
> 
> It appears as though a space has been added at the front of vtesttxt
> 
> Look forward to your help.
> 
> Regards David
> 
> [EMAIL PROTECTED]
> 
> --- RBG7-L
> ================================================
> TO POST A MESSAGE TO ALL MEMBERS:
> Send a plain text email to [email protected]
> 
> (Don't use any of these words as your Subject:
> INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
> REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [email protected]
> In the message SUBJECT, put just one word: INTRO
> ================================================
> TO UNSUBSCRIBE: 
> Send a plain text email to [email protected]
> In the message SUBJECT, put just one word: UNSUBSCRIBE
> ================================================
> TO SEARCH ARCHIVES:
> Send a plain text email to [email protected]
> In the message SUBJECT, put just one word: SEARCH-n
> (where n is the number of days). In the message body, 
> place any 
> text to search for.
> ================================================
> 
> 
> 

Reply via email to