|
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
As an Amazon Associate we earn from qualifying purchases.
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.