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



This is how I understand the situation:

- there is a data entry program where a 12 digit number can be entered.
- We want to use this number to access a file for which the key is alpha of length 10
- We can not remove all leading 0 from the number converted to character.
- I suppose that the length of the converted number must always be the same

Ex: Assume that the alpha number length = 8
So the number 123456 must be translated as ' bb00123456' and the number 23 must be translated to 'bb00000023' if right adjusted.

If I understand the requirement correctly, here is a working solution:

Key_len = 8

Eval(r) key_alpha = %subst(%editc(key_nbr:'X'):%len(%editc(key_nbr:'X'))+1-Key_len:Key_len)

If you want the result left adjusted, just remove the eval(r)


Hope this help

Denis Robitaille
Chef de service TI - Solution Entreprise
Infrastructure et Opérations
Cascades Centre des technologies,
412 Marie Victorin
Kingsey falls(Québec) Canada J0A 1B0
T : 819 363 6130



-----Message d'origine-----
De : RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Hoteltravelfundotcom
Envoyé : 23 février 2016 17:01
À : RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Objet : Re: eval from numeric to alpha?

I don't want to add a entry field if possible. This is in IBS and then would require updating their XT Java screens. As this is a fix, I wanted to minimize my involvement. The one field gets order# for 2 other files that get user locks and it clears it. But ours is an alpha field on the key.

On Tue, Feb 23, 2016 at 4:57 PM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:

On 2/23/2016 3:55 PM, Hoteltravelfundotcom wrote:
Buck, because this new table going against the key there is alpha.

I'll ask the same question from a different angle and maybe we'll connect.

Why use a numeric field when the user must type in an alpha value?

--
--buck

Visit wiki.midrange.com and register for an account. Edit a page that
helps you, and because it's public, you'll help someone else, too!

--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

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.