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



Forget it. It just does not work. Have to be more careful when trying to
answer mails and attending job problems....

(It seems that my few remaining neurons are not longer good at multitasking
:-) )

Regards,


Luis Rodriguez
IBM Certified Systems Expert — eServer i5 iSeries


On Mon, Feb 8, 2010 at 9:45 AM, Luis Rodriguez <luisro58@xxxxxxxxx> wrote:

Disregard,

Old and bad written code (DIGITS and CHAR are redundant in this case).
Should read:

CHAR(ZONED(fielda, 06, 0))

My apologies for the awful code...


Luis Rodriguez
IBM Certified Systems Expert — eServer i5 iSeries


On Mon, Feb 8, 2010 at 9:39 AM, Luis Rodriguez <luisro58@xxxxxxxxx>wrote:

Birgitta,

I think Alan does need a six character formatted field, from a ten
character field. As long as the table has a valid numeric table (ie., not
blanks, at least one zero '0') , this works for me:

----------------------
Create View MySchema/MyView AS(
SELECT char(DIGITS(ZONED(fielda, 06, 0))) AS NewField,
a.*
FROM MySchema/MyTable A
)
----------------------

Regards,


Luis Rodriguez
IBM Certified Systems Expert — eServer i5 iSeries


On Mon, Feb 8, 2010 at 9:24 AM, Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx
wrote:

Hi,

Try the following:

Create View MySchema/MyView as
Select Repeat('0', Length(Trim(MyFld))) concat Trim(Text) as NewText,
a.*
From MyTable a
;

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training
them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Alan Shore
Gesendet: Monday, 08. February 2010 14:32
An: Midrange Systems Technical Discussion
Betreff: Using SQL to obtain a 6 character field from a 3, 4, 5 or 6
character string


Good morning all
what I am trying to achieve sounds so familiar. I believe this was a
discussion that happened a couple of years ago, but I cannot seem to find
it.
Probably searching for the wrong thing

Anyway, heres my dilemma
I have a file with a 10 character field (lets call it FIELDA)
Within this FIELDA, I can have a 3, 4, 5, or 6 character string (not
necessarily left adjusted)
This string happens to be numeric (but for my purposes - it needs to
remain
alpha)
I need to convert this numeric string into a 6 character string with
leading zeroes
AND
I need to create a view/index over this file using this new field as the
key

It being Monday morning, not having my 18th cup of coffee, bleary eyed
from
staying up too long after the super bowl etc. etc.
I just cannot get my head around this, therefore, as always, any and all
help would be MUCH appreciated

Thanks in advance


Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
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: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
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: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.





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.