出力の条件付け標識

出力レコードまたは出力フィールドが書き出される条件を指定するために使用さ れる標識は、プログラム内で事前に定義されていなければなりません。 出力を条件付けする標識は、21 から 29 桁目に指定されます。 出力の条件付けには、すべての標識が有効です。

出力の条件付けに使用する標識は、次のタイプの標識の 1 つとして、事前に定義 されていなければなりません。

標識によってレコード全体を条件付けする場合には、レコード・タイプを指定 する行に標識を記入します (図 22 を参照)。標識によってフィールドの書き出し 時点を条件付けする場合には、フィールド名と 同じ行に記入します (図 22 を参照)。

出力行には、条件付け標識は必須ではありません。条件付け標識が指定されていない場合には、レコード のタイプが出力用に検査されるたびにその行が出力されます。 条件付け標識を指定する場合には、3 つの 別個の出力標識フィールド (22 から 23、25 から 26、および 28 から 29 桁目) のそれぞれに標識を 1 つずつ 記入することができます。これらの標識がオンの場合には、出力操作が実行されます。 各標識の前の 桁 (21、24、または 27 桁目) の N は、標識がオンでない場合にだけ出力操作が 実行されることを意味します (否定標識)。 出力行を否定標識だけで条件付けする必要はありません が、少なくとも 1 つの標 識は肯定とする必要があります。 見出しまたは明細操作を否定標識だけで条件付 けした場合には、その操作は、プログラム・サイクルの始めか、あるいは 1 ペー ジ目 (1P) の行が書き出される時に実行されます。

16 から 18 桁目に AND/OR を指定することによって、AND/OR 関係にある出力標識 を指定することができます。 使用することができる AND/OR 行の数に制限はあり ません。 AND/OR 行は、出力レコードの条件付けに使用することはできますが、フィールド の条件付けに使用することはできません。 しかし、演算仕様書で EVAL 命令を使 用することによって、4 つ以上の標識でフィールドを条件付けすることができます。 以下の例は これを例示しています。

CL0N01Factor1+++++++Opcode(E)+Extended-factor2+++++++++++++++++++++++++++
 * Indicator 20 is set on only if indicators 10, 12, 14,16, and 18
 * are set on.
C                   EVAL      *IN20 = *IN10 AND *IN12 AND *IN14
C                              AND *IN16 AND *IN18
OFilename++DAddN01N02N03Excnam++++.......................................
O..............N01N02N03Field+++++++++YB.End++PConstant/editword/DTformat
 * OUTFIELD is conditioned by indicator 20, which effectively
 * means it is conditioned by all the indicators in the EVAL
 * operation.
OPRINTER   E
O               20      OUTFIELD

出力標識について知っておくべき、その他の特別な考慮事項は、次のとおりです。

出力仕様書でのオーバーフロー標識の割り当てについては、「WebSphere Development Studio: ILE RPG プログラマーの手引き」の印刷装置ファイルの項を参照して ください。

図 22. 出力標識
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
OFilename++DF..N01N02N03Excnam++++B++A++Sb+Sa+...........................
O..............N01N02N03Field+++++++++YB.End++PConstant/editword/DTformat
 *
 *  One indicator is used to condition an entire line of printing.
 *  When 44 is on, the fields named INVOIC, AMOUNT, CUSTR, and SALSMN
 *  are all printed.
 *
OPRINT     D    44                  1
O                       INVOIC              10
O                       AMOUNT              18
O                       CUSTR               65
O                       SALSMN              85
 *
 *  A control level indicator is used to condition when a field should
 *  be printed.  When indicator 44 is on, fields INVOIC, AMOUNT, and
 *  CUSTR are always printed.  However, SALSMN is printed for the
 *  first record of a new control group only if 44 and L1 are on.
 *
OPRINT     D    44                  1
O                       INVOIC              10
O                       AMOUNT              18
O                       CUSTR               65
O                  L1   SALSMN              85
図 23. 1P 標識
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
OFilename++DF..N01N02N03Excnam++++B++A++Sb+Sa+...........................
O..............N01N02N03Field+++++++++YB.End++PConstant/editword/DTformat
 *
 *  The 1P indicator is used when headings are to be printed
 *  on the first page only.
 *
OPRINT     H      1P                   3
O                                            8 'ACCOUNT'
 *
 *  The 1P indicator and an overflow indicator can be used to print
 *  headings on every page.
 *
OPRINT     H    1P                     3  1
O         OR    OF
O                                            8 'ACCOUNT'
図 24. フィールドの印刷防止
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
IFilename++SqNORiPos1+NCCPos2+NCCPos3+NCC................................
I........................Fmt+SPFrom+To+++DcField+++++++++L1M1FrPlMnZr....
 *
 *  When an error condition (zero in FIELDB) is found, the halt
 *  indicator is set on.
 *
IDISK      AA  01
I                                   1   3  FIELDA        L1
I                                   4   8 0FIELDB                  H1
CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq..
 *
 *  When H1 is on, all calculations are bypassed.
 *
C   H1              GOTO      END
C                       :
C                     :               演算
C                       :
C     END           TAG
OFilename++DF..N01N02N03Excnam++++B++A++Sb+Sa+...........................
O..............N01N02N03Field+++++++++YB.End++PConstant/editword/DTformat
 *
 *  FIELDA and FIELDB are printed only if H1 is not on.
 *  Use this general format when you do not want information that
 *  is in error to be printed.
 *
OPRINT     H    L1                  0  2 01
O                                           50 'HEADING'
O          D    01NH1                  1  0
O                       FIELDA               5
O                       FIELDB        Z     15