|
There's a really simple way to do this in RPG.
EVALR.
Simply code EvalR result = shortField;
Or if shortField has trailing spaces then:
EvalR result = %TrimR(shortField);
I cannot agree with Jonathan about using SQL for tasks like this - SQL is
great for what it is designed for. Replacing a perfectly good built-in
language feature is not what it was designed for. If you need to right
adjust _within_ and SQL operation sure but ...
Just my 10 cents worth.
Jon P.
On Mar 26, 2023, at 3:49 PM, Jonathan Ball <jonball52@xxxxxxxxx> wrote:' STUFF'
I tend to do all of this kind of activity in SQL whenever possible.
dcl-s char_15 char(15);
dcl-s char_30 char(30);
dcl-s char_7 char(7) inz('STUFF'); // char_7 = 'STUFF '
exec sql
set :char_15 = lpad(rtrim(:char_7), length(:char_15)); // char_15 =
'40404040404040404040E2E3E4C6C6'
exec sql
set :char_30 = hex(:char_15); // char_30 =
simpler to use than equivalent RPGLE BIFs, and there aren't always
In find SQL built-in functions intuitively easier to understand and
equivalents.
related questions.
On 2/14/2023 1:04 PM, dfreinkel@xxxxxxxxxxxxxxxxx wrote:
What is a good and simple way to right justify a character field?
I would not like to use a do loop to do this.
Thanks
Darryl Freinkel
A4G
Telephone: 770.321.8562 Mobile: 678.355.8562
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
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.