結果標識の割り当てに関する規則
結果の標識を割り当ている場合には、以下の点に留意してください。
- 結果のフィールドが配列全体を参照している場合には、結果の標識を使用す ることはできません。
- 複数の命令の結果をテストするために同じ標識を使用した場合には、処理さ れた最後の命令によって、標識の設定状況が決まります。
- L1 から L9 標識が結果の標識として使用され、オンに設定されても、それより 低いレベルの標識はオンに設定されません。 例えば、L8 がオンに設定されても、L1 から L7 はオンに設定されません。
- H1 から H9 標識が結果の標識として使用された時にオンに設定されると、プロ グラム・サイクル中の検査の前に停止標識をオフに設定しない限り、プログラムは 停止します (RPG サイクルおよびその他の暗黙論理を参照)。
- 指定した命令によっては、複数の条件のテストに同じ標識を使用することが できます。
図 1. 演算の条件付けに使用される結果の標識
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq..
*
* Two resulting indicators are used to test for the different
* conditions in a subtraction operation. These indicators are
* used to condition the calculations that must be processed for
* a payroll job. Indicator 10 is set on if the hours worked (HRSWKD)
* are greater than 40 and is then used to condition all operations
* necessary to find overtime pay. If Indicator 20 is not on
* (the employee worked 40 or more hours), regular pay based on a
* 40-hour week is calculated.
*
C HRSWKD SUB 40 OVERTM 3 01020
*
C N20PAYRAT MULT (H) 40 PAY 6 2
C 10OVERTM MULT (H) OVRRAT OVRPAY 6 2
C 10OVRPAY ADD PAY PAY
*
* If indicator 20 is on (employee worked less than 40 hours), pay
* based on less than a 40-hour week is calculated.
C 20PAYRAT MULT (H) HRSWKD PAY
*