× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



What about EvalR?

evalr Result = '000' + %trim(fieldA) ;

Thanks

Bob Cagle
IT Manager
Lynk

-----Original Message-----
Alan Shore

Hi everyone
Before I forget - we are on V7r1
Apologies for the subject title - I couldn't think of what to place there that would NOT be a lengthy title

Here is my predicament
I am just not thinking straight

I am writing an RPG embedded SQL program I am reading a file that contains multiple fields, but one field in particular can contain a value that is 1 to 6 characters in length when trimmed I need to place those 1 to 6 characters into a 6 character field with leading zeroes For example
Field A value Result
A 00000A
XYZ 000XYZ

I could create a select and interrogate the length of the trimmed value Select When %len(%trim(fieldA)) = 1,
Result = '00000" + %trim(fieldA); When %len(%trim(fieldA)) = 2,
Result = '0000" + %trim(fieldA); Etc.
Endsl;

The reason why I am looking to do this using "nifty" coding is that I have to do the same with a 40 character field later on

Hope this makes some sense

As always - all answers gratefully accepted

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.