ENHANCED-FORMAT CALCULATION SPECIFICATIONS


Enhanced-format calculation specifications have been available since RPG IV was introduced. This style specification is the most popular for new applications and for maintenance (i.e., program changes) to existing applications. This style can be easier to use and may provide a level of productivity far beyond that of the traditional fixed-format specification. Figure 12.2 contains an example use of the enhanced-format specifications.

start figure

 .....CSRn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++ 0001 C     CustNo        Chain     CustRec 0002 C                   if        %Found 0003 C                   Eval      Visits = Visits + 1 0004 C                   Update    CustRec 0005 C                   endif 

end figure

Figure 12.2: Enhanced/alternative format calculations

In Figure 12.2, line one accesses the Customer master file using the traditional CHAIN operation; however no resulting indicators are used. Instead, line 2 uses the %FOUND built-in function to test the result of the CHAIN operation. This built-in function equates to *ON if the CHAIN operation is successful, otherwise it is set to *OFF. Line 3 performs the arithmetic add operation, replacing the ADD operation code. Then, on line 4 the update operation is performed; all the fields of the customer master file are rewritten to the database.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net