HP 3000 Manuals

Control Level(Columns 7-8) [ HP RPG/iX Reference Manual ] MPE/iX 5.0 Documentation


HP RPG/iX Reference Manual

Control Level(Columns 7-8) 

The Control Level field determines when the operation entered in columns
28-32 of this specification is performed.  Calculation specifications can
be executed at detail time, total time, at the end of the program, or as
a subroutine (see the HP RPG Programmer's Guide for information on when
these events occur in the RPG logic cycle).

          Table 8-1.  Control Level (Columns 7-8) 

--------------------------------------------------------------------------------------------
|                       |                                                                  |
|      Columns 7-8      |                           Description                            |
|                       |                                                                  |
--------------------------------------------------------------------------------------------
|                       |                                                                  |
|          L0           | The operation is always performed at total time because the L0   |
|                       | indicator is always ON. You can use L0 to condition operations   |
|                       | on input records that do not have control fields.                |
|                       |                                                                  |
|         L1-L9         | The operation is performed at total time before the first record |
|                       | in the new control group (for this indicator) is processed, or   |
|                       | after the indicator is turned ON by a SETON operation.           |
|                       |                                                                  |
|          LR           | The operation is performed after the last record is processed,   |
|                       | or after the LR indicator is turned ON by a SETON operation.     |
|                       |                                                                  |

|          SR           | The operation is part of an internal subroutine and is performed |
|                       | by an EXSR operation at detail time or total time (SR in columns |
|                       | 7-8 is optional).                                                |
|                       |                                                                  |
|          AN           | Establishes an AND relationship between indicators on this and   |
|                       | previous lines.                                                  |
|                       |                                                                  |
|          OR           | Establishes an OR relation between indicators on this and        |
|                       | previous lines or in a previous AND relationship.                |
|                       |                                                                  |
|         blank         | The operation is performed at detail time.  Or, if the           |
|                       | calculation specification is within a sub-routine, it is         |
|                       | performed when the sub-routine is invoked.                       |
|                       |                                                                  |
--------------------------------------------------------------------------------------------

L1-L9 (Control-Level Indicators) 

When you use L1-L9 indicators in a Calculation Specification, the
operation is performed when there is a control break in the field
associated with it (see the Control Level Field (columns 59-60) of the
Input Specification) or in a field associated with an indicator of higher
rank.  For example, if you assign the control-level indicators L1, L2,
and L3, a control break that turns ON L3 also turns ON L1 and L2.  When
the LR indicator is turned ON, L1-L9 are turned ON.

Control-level indicators can also be turned on by the SETON operation, by
the record type identification, and by testing non-control fields.  Under
these conditions, however, control-level indicators of lower rank are not
turned ON.

Example 

Figure 8-2 shows two operations conditioned by control-level indicators.
Line 1 is conditioned by L2 and line 2 is conditioned by L1.  When a
control break occurs for the control field associated with L2, L1 and L2
are both turned ON and both operations are performed.
___________________________________________________________________________________
|                                                                                 |
|                1         2         3         4         5         6         7    |
|            678901234567890123456789012345678901234567890123456789012345678901234|
|              _______________________________________________________            |
|                                                                                 |
|     1     CL2         ALPHA     ADD  BETA      RES1   100                       |
|     2     CL1                   MOVE RES       OUTPT  10                        |
|                                                                                 |
|                                                                                 |
|                                                                                 |
___________________________________________________________________________________

          Figure 8-2.  Using Control-Level Indicators to Condition Calculation Specification Operations 

LR (Last-Record Indicator) 

The LR indicator is turned ON after the last input record is processed.
When LR is turned ON, the control-level indicators L1-L9 are also turned
ON. Use the LR indicator to condition operations that you want to perform
at the end of the program.

You can turn the LR indicator ON by entering it in the Resulting
Indicators field (columns 54-59) of another specification.

SR (Subroutine Identifier) 

You can use the SR identifier with operations that are part of an
internal subroutine, though it is optional.  Internal subroutines begin
with the BEGSR operation and are executed by specification of EXSR
operations at detail time.  Enter internal subroutine operations after
all other Calculation Specifications in the program.

AN(D), OR Lines 

AN(D) and OR lines let you condition an operation using more than three
indicators.  See the Indicators Field (columns 9-17) for more
information.

Columns 7-8 on the line preceding the AN(D) and OR lines determines
whether the operation takes place at detail time, total time, or end of
program.  When you use AN(D) lines, the operation is performed only when
all indicator conditions are satisfied.  For OR lines, the operation is
performed when any of the indicator conditions in the OR lines are
satisfied.

When entering AN(D) and OR lines, follow these steps:

   1.  Precede the AN(D) or OR line with a specification that contains
       L0-L9, LR, SR, or blanks in the Control Level Field (columns 7-8),
       or from one to three indicators in the Indicators Field (columns
       9-17).  Leave columns 18-59 blank.

   2.  Enter the AN(D) or OR line by placing AN or OR in the Control
       Level Field and the indicators in the Indicators Field.  If this
       is not the last AN(D) or OR line, leave columns 18-59 blank.  (You
       may enter up to seven of these AN(D) and OR lines.)

   3.  On the last AN(D) or OR line, enter the operation to perform and
       the data fields to use for the operation.

Example 

Figure 8-3 shows how to use AN(D) and OR lines.  The AN(D) line (line 1)
causes the operation on that line to be executed when indicators 03, 04,
05, and 06 are all turned ON. The AN(D) and OR lines in lines 2 and 3
cause the operation in line 3 to be performed when indicators 01, 02, 03,
and 04 are turned ON, or when indicator 05 is turned ON.
___________________________________________________________________________________
|                                                                                 |
|                1         2         3         4         5         6         7    |
|            678901234567890123456789012345678901234567890123456789012345678901234|
|              _______________________________________________________            |
|                                                                                 |
|            C   03 04 05                                                         |
|     1     CAN 06      ETA       ADD  ZETA      RES3   100                       |
|            C                       .                                            |
|            C                       .                                            |
|            C   01 02 03                                                         |
|     2     CAN 04                                                                |
|     3     COR 05      OMEGA     SUB  OMICRON   RES4   100                       |
|                                                                                 |
|                                                                                 |
|                                                                                 |
___________________________________________________________________________________

          Figure 8-3.  Using Calculation Specification AN(D) and OR Lines 



MPE/iX 5.0 Documentation