how flexible are your calcu...,3
TRANSCRIPT
-
8/9/2019 How Flexible Are Your Calcu...,3
1/7
-
8/9/2019 How Flexible Are Your Calcu...,3
2/7
-
8/9/2019 How Flexible Are Your Calcu...,3
3/7
Business Strategy
Competitive Advantage
Consolidation
Executive Perspective
Green IT
Migration
Open Source
ROI
Infrastructure
Blades
StorageSystems Management
Case Studies
Distribution
Healthcare
Manufacturing
Services
Web 2.0
Cloud
Social Media
Trends
Collaboration
IBM AnnouncementsIBM Research
Open Source
Social Media
What's New
Product News
AIX
MAINFRAME
POWER
Newsletters
About Us
Subscribe
Current Issue
Archive
IBM i
ALL EDITIONS
ADMINISTRATOR
DEVELOPER
TRENDS
TIPS & TECHNIQUES
CASE STUDIES
Flexible are Your Calculations? | IBM i | IBM Systems Magazine http://www.ibmsystemsmag.com/ibmi/enewsletterexclusive/1706
9/27/2010
-
8/9/2019 How Flexible Are Your Calcu...,3
4/7
STORAGE
PRODUCT NEWS
ENDPGM
BUYER'S GUIDE
Developer> RPG
How Flexible are Your Calculations?RPG programming techniques to help you solve unsolvable problems.
September 2007 | by Jon Parisand Susan Gantner
Print Email
Well leave to your imagination what the subprocedures look like! (Or if your imagination fails you, you can study the full source code.) But before
we move on, well just show you the prototype for the calcroutine and one of the subprocedure prototypes (of necessity all of the others have the
same basic format). Notice that the calc prototype uses the EXTPROC keyword and there are no single quotation marks around the name this
indicates that currentOpPtris a procedure pointer and will determine which procedure is called. Notice also that the prototype for the add
subprocedure has exactly the same definition in terms of return value and parameters as does calc.
Adding new operations is a breeze. Simply code the new subprocedures, add the required codes to the operationsdata structure and the related
subprocedure information to the pProceduresdata structure - remembering to modify the DIM clauses of course! The main calculations wont
change at all.
So Far, So Good What Now?
We now have the mechanics in place to add as many different operations as we want. But what about referencing the variables by name? We coulduse the multi-level IF-block approach, but it has the same disadvantages as it had for the operation codes themselves. It may not be immediately
obvious, but we can adopt a similar approach for the variables to the one we used for the operation codes.
One approach we considered was to modify the subprocedures to accept pointers to the variables to be processed, but that didn't help with another
problem we needed to address namely, that when you pass a parameter, the parameter definitions in the caller and the callee must match. The
variables we want to use in our calculations probably wont be the same size and type. With a normal subprocedure, we could solve this with the
CONST or VALUE keywords. These would cause the compiler to generate the necessary code to convert the caller's variable to the size and type
required by the subprocedure. But by definition our variables will change users can select which ones to use.
Next page: >>
Page 123 456
Flexible are Your Calculations? | IBM i | IBM Systems Magazine http://www.ibmsystemsmag.com/ibmi/enewsletterexclusive/1706
9/27/2010
-
8/9/2019 How Flexible Are Your Calcu...,3
5/7
Jon Paris is a technical editor with IBM Systems Magazine and co-owner of Partner400.
More Articles From Jon Paris
Susan Gantner is a technical editor with IBM Systems Magazine and co-owner of Partner400.
More Articles From Susan Gantner
Advertisement
WEBINAR -- RPG OA and Beyond from looksoftware Tuesday, September 28, 2010, 10 am BST (Europe)
Wednesday, September 29, 2010, 2 pm EST (USA)
Browse products and services for Developer.
Advertisement
Flexible are Your Calculations? | IBM i | IBM Systems Magazine http://www.ibmsystemsmag.com/ibmi/enewsletterexclusive/1706
9/27/2010
-
8/9/2019 How Flexible Are Your Calcu...,3
6/7
Maximize your IT investment with monthly information from THE source...IBM Systems MagazineEXTRA & Marketplace eNewsletters.
SUBSCRIBE NOW.
View past IBM i EXTRAs here
Related Articles
Even More Flexible Calculations
E-Newsletter Exclusive | In the September EXTRA e-Newsletter, Jon Paris and Susan Gantner shared some solutions to &qout;unsolvable&qout;
RPG problems with a technique for flexible calculations. Now they delve deeper with a more complex example, making a sequence of calculations
not only possible but simple to create and use.
RPG - Anchoring Your Team
Cover Story | Alternate approaches to extending your RPG applications.
The State of Modernization
Cover Story | Bruce Vining talks modernization with Jon Paris and Susan Gantner
RPG for the Web
Flexible are Your Calculations? | IBM i | IBM Systems Magazine http://www.ibmsystemsmag.com/ibmi/enewsletterexclusive/1706
9/27/2010
-
8/9/2019 How Flexible Are Your Calcu...,3
7/7
iSeries EXTRA: By Now, the Case for RPG IV Should Be a No-Brainer
E-Newsletter Exclusive
IBM i
AIX
MAINFRAME
POWER
Homepage
About Us
Contact UsSubscriptions
Editorial Calendar
Advertise With Us
Reprints
Privacy Policy
Terms of Service
Sitemap
IBM Systems Magazine is a trademark of International Business Machines Corporation. The editorial content of IBM Systems Magazine is placed on
this website by MSP TechMedia under license from International Business Machines Corporation.
2010 MSP Communications, Inc. All rights reserved
Flexible are Your Calculations? | IBM i | IBM Systems Magazine http://www.ibmsystemsmag.com/ibmi/enewsletterexclusive/1706