HP 3000 Manuals

Resulting Indicators(Columns 54-59) [ HP RPG/iX Reference Manual ] MPE/iX 5.0 Documentation


HP RPG/iX Reference Manual

Resulting Indicators(Columns 54-59) 

The resulting indicators field lets you set one to three indicators to
reveal the outcome of the operation.  At a later point in the program,
you can then use the indicators to direct program execution.

------------------------------------------------------------------------------------
|                       |                       |                                  |
|        Column         |         Value         |           Description            |
|                       |                       |                                  |
------------------------------------------------------------------------------------
|                       |                       |                                  |
| High Subfield         | 01-99, F0-F9, H0-H9,  | The indicator that is turned ON  |
| (54-55):              | KA-KN, KP-KY, L0-L9,  | when a high condition exists     |
|                       |  LR, MR, OA-OG, OV,   | (see the operation for specific  |
|                       |       U1-U8 1P        | information).                    |
|                       |                       |                                  |
|                       |         blank         | Do not test data in this field.  |
|                       |                       |                                  |
| Low Subfield (56-57): | 01-99, F0-F9, H0-H9,  | The indicator that is turned ON  |
|                       | KA-KN, KP-KY, L0-L9,  | when a low condition exists (see |
|                       |  LR, MR, OA-OG, OV,   | the operation for specific       |
|                       |       U1-U8 1P        | information).                    |
|                       |                       |                                  |
|                       |         blank         | Do not test data in this field.  |
|                       |                       |                                  |
| Equal Subfield        | 01-99, F0-F9, H0-H9,  | The indicator that is turned ON  |
| (58-59):              | KA-KN, KP-KY, L0-L9,  | when a equal condition exists    |
|                       |  LR, MR, OA-OG, OV,   | (see the operation for specific  |
|                       |       U1-U8 1P        | information).                    |
|                       |                       |                                  |
|                       |         blank         | Do not test data in this field.  |
|                       |                       |                                  |
------------------------------------------------------------------------------------

When you use an indicator in this field, be sure you understand how it is
used in the RPG logic cycle (see the HP RPG Programmer's Guide).

Indicators that you enter in this field are turned OFF before the
operation, and are turned ON only when the condition (indicated by the
subfield in which you enter it) is satisfied.  If you use the same
indicator with consecutive operations, the last operation determines the
indicator setting.  If you enter a general indicator, you can use it
later to condition calculation or output operations.  If you enter a halt
indicator, you can use it to suppress output operations or to halt the
program.

High Subfield(Columns 54-55) 

An indicator entered in the high subfield is turned ON:

   *   When an arithmetic operation produced a positive (greater than
       zero) Result Field.

   *   In a COMP operation, when Factor 1 is greater than Factor 2.

   *   In a LOKUP operation, when the Factor 2 table or array element is
       greater than Factor 1.

   *   During a CHAIN operation, when a record was not found.

   *   When a TESTB operation reveals that the bits in a field are zero.

   *   When a TESTZ operation reveals that the zone bits of a field are
       positive, representing the ASCII characters &, A-I.

   *   When a TESTN operation reveals that an alphanumeric field contains
       ASCII digits.  (The low-order bits can still represent A-R.)

   *   When a SETON or SETOF operation uses the indicator.

Low Subfield(Columns 56-57) 

An indicator entered in the low subfield is turned ON:

   *   In arithmetic operations, when the Result Field is negative.

   *   During the COMP operation, when Factor 1 is less than Factor 2.

   *   During the LOKUP operation, when the Factor 2 table or array
       element is less than Factor 1.

   *   When a TESTB operation reveals that the bits in a field are mixed;
       some ON and some OFF. (The operation is not meaningful if you test
       a single bit.)

   *   When a TESTZ operation reveals that the zone bits in a field are
       all negative, representing the ASCII characters minus (-) and J-R.

   *   When a TESTN operation reveals that an alphanumeric field (that
       must be at least two characters long) contains ASCII digits and
       leading blanks.

   *   For a TurboIMAGE chaining file (Input/Output Mode Field (column
       67) in the File Description Specification Continuation line is C
       or R), when end-of-chain is encountered.

   *   When a SETON or SETOF operation uses the indicator.

Equal Subfield(Columns 58-59) 

An indicator entered in the equal subfield is turned ON:

   *   In arithmetic operations, when the Result Field is zero.

   *   During the COMP operation, when Factor 1 equals Factor 2.

   *   During the LOKUP operation, when the Factor 2 table or array
       element equals Factor 1.

   *   When a TESTB operation reveals that the bits in a field are all
       ON.

   *   When a TESTZ operation reveals that the zone bits in a field are
       not all positive or all negative; they represent characters other
       than &, A-I, -, or J-R.

   *   When a TESTN operation reveals that an alphanumeric field contains
       all blanks.

   *   When a READ operation for a demand file encountered end-of-file.

   *   When a SETON or SETOF operation uses the indicator.

Example 

Figure 8-49 shows how to set a resulting indicator and how to use it in
subsequent Calculation Specifications.  The MULT operation in line 1
turns indicator 20 ON when COST is negative.  The ZSUB operation in line
2 is executed only when COST is negative (indicator 20 is ON). If the
result (TCOST) of the SUB operation in line 3 is negative, indicator 20
is turned ON and it is turned OFF if the result is positive or zero.  (At
the beginning of the next program cycle, indicator 20 is turned OFF
automatically.)
________________________________________________________________________________
|                                                                              |
|             1         2         3         4         5         6         7    |
|         678901234567890123456789012345678901234567890123456789012345678901234|
|           _______________________________________________________            |
|                                                                              |
|     1  C           MILES     MULT .48       COST   102   20                  |
|         C                                                                    |
|     2  C   20                Z-SUBCOST      COST                             |
|         C                                                                    |
|     3  C           COST      SUB  .05       TCOST  102   20                  |
|                                                                              |
|                                                                              |
________________________________________________________________________________

          Figure 8-49.  Using Resulting Indicators 



MPE/iX 5.0 Documentation