|
poor MOVE, getting its ass kicked. From the sounds of people saying they prefer specific functions that work on specific types of data, a reader would guess that everyone would rather code in assembler! MOVE does what it says it does. It copies the value of factor 2 into the result variable. When the data types dont match, the copied value is converted in a predictable way, just like the programmer wants it to. In my view, the only problem with MOVE is that it does not pad fill the result variable. For the price of not allowing fixed position rpg to be upgraded to /free, it seems like keeping /free MOVE free is not worth the "trouble" of including it. Steve -----Original Message----- From: rpg400-l-bounces@midrange.com [mailto:rpg400-l-bounces@midrange.com]On Behalf Of Joel Fritz Sent: Wednesday, February 12, 2003 12:32 PM To: 'RPG programming on the AS400 / iSeries' Subject: RE: MOVE (was: /FREE RPG compiler errors) Got to agree with you. I never learned the ins and outs of MOVE for two reasons. First I was too lazy to memorize it all, and second I really didn't like the idea of MOVE doing anything but simple minded assignment. I don't like "tricky" code if it doesn't give a HUGE performance boost. I want to make sure a complete idiot like me can understand the program. In RPG Classic it's not too hard to do the other things MOVE can do without using it. For some things like numeric conversions using MOVE doesn't save you much work if you take the trouble to validate the data. I've gotten a couple <g> of support calls in the middle of the night about programs that use MOVE to convert character to numeric. > -----Original Message----- > From: Buck Calabro [mailto:Buck.Calabro@commsoft.net] > Sent: Wednesday, February 12, 2003 6:23 AM > To: RPG programming on the AS400 / iSeries > Subject: RE: MOVE (was: /FREE RPG compiler errors) > > > >Buck Calabro wrote: > >> c move cust suffix > >> and then I get to find out that this is really extracting > >> the last three characters of the customer ID, which > >> nominally looks like "1234567-001". In this example, > >> it's really "substring the last three characters" and > >> not a MOVE at all. > > > >Buck, assuming "suffix" is exactly big enough to hold the > >suffix, use EVALR. > > EVALR suffix = cust; > > Hi Barbara! > Yes indeed. However... > > (Opinion alert!) This seems like multiplying by 10000.01 to > flip MMDDYY to > YYMMDD. It works, but the operation hides the intent > somewhat. The "real" > thing that's happening is that I am extracting a substring. > If I were doing > this in any other language (even MI!) I would use substring. > In RPG II, I > used the I specs to effectively substring. In RPG III with externally > defined files, *I* would have used a data structure. Someone > else used > MOVE. In RPG IV, if I saw a MOVE I would substitute a > substring. I believe > that broadcasts the intent of the code better. > > I understand the purpose of your post is to show how many of the > straightforward uses of MOVE directly map to EVAL, but I'm > going a step > beyond that and saying that MOVE wasn't the choice I would > have made in the > first place. > --buck > _______________________________________________ _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@midrange.com 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.