HP 3000 Manuals

Ch 8. Calculation Specifications [ HP RPG/iX Reference Manual ] MPE/iX 5.0 Documentation


HP RPG/iX Reference Manual

Chapter 8  Calculation Specifications 

Introduction 

The Calculation Specification lets you perform arithmetic operations and
other types of operations such as searching tables and arrays, moving
data internally, performing subroutines, and using system intrinsics.
(See "Operation Field" in this chapter for a list of the Calculation
Specification operations.)

The Calculation Specification specifies:

   *   Whether to perform the operation at detail time or total time;
       whether to perform the operation as a subroutine; or, whether to
       perform the operation at all.

       Detail-time operations are performed for each input record.  For
       instance, a program that calculates employee payroll performs
       detail calculations for each employee record.  Total-time
       operations use data accumulated from a group of related records (a
       control group).  Total-time operations are performed when a
       control break occurs (the current record's control field differs
       from that of the previous record).  For instance, a payroll that
       accumulates employee pay by department contains Calculation
       Specifications for processing department totals.

       To execute a Calculation Specification operation at detail time,
       leave the Control Level Field (columns 7-8) blank.  (Additionally,
       to execute detail-time calculations only in certain circumstances,
       "condition" those specifications by entering general indicators in
       their Indicator Fields (columns 9-17).)  To execute a Calculation
       Specification operation at total time, enter a control-level
       indicator (L0-L9, LR) in the Control Level Field.

       Subroutines are executed by the EXSR operation.

   *   The operation to perform, the data to use in the operation, and
       where to store the result.  Specify the operation in columns
       28-32, the data in columns 18-27 (or columns 33-42), and the
       result field in columns 43-51.

   *   The tests to perform on the results of the operation.  You do this
       by entering indicators in the Resulting Indicators Field (columns
       54-59) of the operations that produce the results.  Then you
       condition subsequent operations with those indicators.

When you enter Calculation Specification operations, enter them in this
order:

   1.  Detail-time operations.
   2.  Total-time operations.
   3.  Subroutine operations.

The Calculation Specification is identified by a C in column 6:
___________________________________________________________________________________
|                                                                                 |
|                1         2         3         4         5         6         7    |
|            678901234567890123456789012345678901234567890123456789012345678901234|
|              _______________________________________________________            |
|                                                                                 |
|            C                                                                    |
|                                                                                 |
|                                                                                 |
___________________________________________________________________________________

          Figure 8-1.  The Calculation Specification 



MPE/iX 5.0 Documentation