>>>>Is there more concise way of converting a memory variable from A15 to A14
>>>>Here's what i have - seems a tad convoluted to me. Maybe i should just be grateful i got it on one line.
>>>>
>>>>n1="A15"
>>>>n2="A"+LTRIM(STR(VAL(SUBSTR(n1,2,2))-1))
>>>>
>>>>tnx
>>>>k
>>>Don't know if you need this or not..........taking Borislav's solution and making it generic so that it isn't for just two characters
>>>n2 = "A" + TRANSFORM(VAL(SUBSTR(n1,2)))
>>
>>And this keeps working below 10. The trouble with transform() without picture parameter sometimes gives you unexpected result - with decimals etc. If two-digit result is desirable, then I'd rather have
>>
>>
n2 = "A" + TRANSFORM(VAL(SUBSTR(n1,2)), "@L 99")
>
>I don't see how I can change n2 to A14 with this solution.
>Borislav's solution enabled me to change the numeric portion of the variable.
The trouble here is that you're trying to keep a number inside a string, and still do arithmetic with it, which is doable but ugly. The major problem is the width of the number, which may exceed the space available in the string - you didn't specify any bounds, so I just assumed two digits and solved it for two digits with leading zero as needed.
The other trouble is negative numbers... but I'll just assume that it's already settled in your specs. The details, the details...
I'd rather keep the number separately and output it with the character prefix when needed. Again, not knowing the specs of your problem, that may be overkill (or, speaking serbian, "killing an ox for a kilo of meat").