制御レベル標識に関する規則

制御レベル標識を割り当ている場合には、以下の点に留意してください。

図 3 は、このような不要な制御の切れ目を防ぐ方法例を示し ています。

図 1. 制御レベル標識 (2 つのレコード・タイプ)
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
A* EMPLOYEE MASTER FILE -- EMPMSTL
A          R EMPREC                    PFILE(EMPMSTL)
A            EMPLNO         6
A            DEPT           3
A            DIVSON         1
A*
A*                 (ADDITIONAL FIELDS)
A*
A          R EMPTIM                    PFILE(EMPMSTP)
A            EMPLNO         6
A            DEPT           3
A            DIVSON         1
A*
A*                 (ADDITIONAL FIELDS)
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
IFilename++SqNORiPos1+NCCPos2+NCCPos3+NCC................................
I........................Fmt+SPFrom+To+++DcField+++++++++L1M1FrPlMnZr....
 *
 *  In this example, control level indicators are defined for three
 *  fields.  The names of the control fields (DIVSON, DEPT, EMPLNO)
 *  give an indication of their relative importance.
 *  The division (DIVSON) is the most important group.
 *  It is given the highest control level indicator used (L3).
 *  The department (DEPT) ranks below the division;
 *  L2 is assigned to it.  The employee field (EMPLNO) has
 *  the lowest control level indicator (L1) assigned to it.
 *
IEMPREC        10
I                                          EMPLNO        L1
I                                          DIVSON        L3
I                                          DEPT          L2
 *
 *  The same control level indicators can be used for different record
 *  types.  However, the control fields having the same indicators must
 *  be the same length.  For records in an externally described file,
 *  the field attributes are defined in the external description.
 *
IEMPTIM        20
I                                          EMPLNO        L1
I                                          DEPT          L2
I                                          DIVSON        L3
図 2. オーバーラップする制御フィールド
この図は、オーバーラップする制御フィールドを示しています。
図 3. 不要な制御の切れ目を防ぐ方法
この図は、不要な制御の切れ目を防ぐ方法を示しています。
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
IFilename++SqNORiPos1+NCCPos2+NCCPos3+NCC................................
I........................Fmt+SPFrom+To+++DcField+++++++++L1M1FrPlMnZr....
ISALES         01
I                                  1    2  L2FLD         L2
I                                  3   15  NAME
IITEM          02
I                                  1    2  L2FLD         L2
I                                  3    5  L1FLD         L1
I                                  6    8  AMT
CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq..
 *  Indicator 11 is set on when the salesman record is read.
 *
C   01              SETON                                        11
 *
 *  Indicator 11 is set off when the item record is read.
 *  This allows the normal L1 control break to occur.
 *
C   02              SETOFF                                       11
C   02AMT           ADD       L1TOT         L1TOT             5 0
CL1   L1TOT         ADD       L2TOT         L2TOT             5 0
CL2   L2TOT         ADD       LRTOT         LRTOT             5 0
 *
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
OFilename++DF..N01N02N03Excnam++++B++A++Sb+Sa+...........................
O..............N01N02N03Field+++++++++YB.End++PConstant/editword/DTformat
OPRINTER   D    01                  1  1
O                       L2FLD                5
O                       NAME                25
O          D    02                     1
O                       L1FLD               15
O                       AMT           Z     15
 *
 *  When the next item record causes an L1 control break, no total
 *  output is printed if indicator 11 is on.  Detail calculations
 *  are then processed for the item record.
 *
OFilename++DF..N01N02N03Excnam++++B++A++Sb+Sa+...........................
O..............N01N02N03Field+++++++++YB.End++PConstant/editword/DTformat
O          T    L1N11               1
O                     L1TOT           ZB    25
O                                           27 '*'
O          T    L2                  1
O                     L2TOT           ZB    25
O                                           28 '**'
O          T    LR                  1
O                     LRTOT           ZB    25
REQTEXT

レコード・タイプが異なっていても、通常は同数の制御フィールドがあります 。しかし、アプリケーションによっては、一部のレコードに異なる数の制御フィールドが 必要な場合があります。

販売担当者レコードには、L2 の制御フィールドしかありません。 品目レコード には、L1 と L2 の両方の制御フィールドがあります。 通常の RPG IV のコーディングでは、販売担当者レコードに続く最初の品目レコードに よって不要な制御の切れ目が生じます。 これは、販売担当者レコードの直後の L1 の制御の切れ目によって認識され、その結果、販売担当者レコードの下の行に アスタリスクが印刷されます。