|
So are you saying you'll cringe if I call a subprocedure moveLeft4of6()?
:-P
On 12/9/2013 12:54 PM, Jon Paris wrote:
"As grotchy as it is, MOVEL at least hinted that the goal was to extract
some (or all) of one field."
The only hint it gave Buck was that whenever you saw a MOVE of _any_ flavor the only thing you knew for sure was that some data moved somewhere. You knew you had to go study data types and lengths before you knew what was happening. One of many reasons why I always hated the MOVE family and was thrilled when they wed dropped.
On 2013-12-09, at 1:38 PM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:
On 12/9/2013 11:31 AM, Vernon Hamberg wrote:Jon Paris
I'm looking at some code - the purpose is to put the 1st 4 digits of aAs grotchy as it is, MOVEL at least hinted that the goal was to extract
6-digit variable into a 4-digit numeric variable.
It is being done with the MOVEL opcode now.
I'm wondering about efficient alternative methods. One I can think of is
to use a data structure -
dcl-ds dsMoveL qualified;
num4 zoned(4);
num6 zoned(6) pos(1);
end-ds;
Anything simpler? Better performing?
some (or all) of one field.
If the case is that all rows containing NUM6 need to have the first 4
digits extracted, I favour the data structure. For an example, let's
say I was spinning through post-mortems of my SQL failures. SQLSTATE is
a 5 digit code, the first two of which are the class. 00 is normal, 01
is warning, etc. For nefarious reasons, I'm only interested in the
class, not the detail. Using a data structure makes it crystal clear to
me that the class is a subset of the whole.
I could use division or multiplication to extract the class but that
would be a side effect due to truncation as opposed to the primary
purpose of mathematical division. Decent names would hint at the intent
of division though.
--buck
--
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.
www.partner400.com
www.SystemiDeveloper.com
--
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.
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.