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