Thanks Bob
Never used evalr before
Just wrote a quick program and ran it in debug
Bingo, gringo
Works like a charm
Appreciated
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 Bob Cagle
Sent: Friday, November 10, 2017 11:19 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: RE: RPG question
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
--
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.