× 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.



Thanks John
This has already been mentioned by Mark
I never used evalr before - but a small program and running under debug confirms that this is exactly what I was looking for
Plus Birgitta also sent an SQL method, which I have saved off to my SQL tips folder

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


-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Friday, November 10, 2017 1:25 PM
To: Midrange-L Midrange-l <midrange-l@xxxxxxxxxxxx>
Subject: Re: RPG question

EVALR Result = '00000' + %Trim(Field); // Assumes that field will never be all blank


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Nov 10, 2017, at 11:10 AM, Alan Shore <ashore@xxxxxxxx> wrote:

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

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.