EXCEPT (Calculation Time Output)

Free-Form Syntax EXCEPT {except-name}
Code Factor 1 Factor 2 Result Field Indicators
EXCEPT   except-name        

The EXCEPT operation allows one or more records to be written during either detail calculations or total calculations. See Figure 1 for examples of the EXCEPT operation.

When specifying the EXCEPT operation remember:
  • The exception records that are to be written during calculation time are indicated by an E in position 17 of the output specifications. An EXCEPT name, which is the same name as specified by the except-name operand of an EXCEPT operation, can be specified in positions 30 through 39 of the output specifications of the exception records.
  • Only exception records, not heading, detail, or total records, can contain an EXCEPT name.
  • When the EXCEPT operation with a name specified in the except-name operand is processed, only those exception records with the same EXCEPT name are checked and written if the conditioning indicators are satisfied.
  • When no except-name is specified, only those exception records with no name in positions 30 through 39 of the output specifications are checked and written if the conditioning indicators are satisfied.
  • If an exception record is conditioned by an overflow indicator on the output specification, the record is written only during the overflow portion of the RPG IV cycle or during fetch overflow. The record is not written at the time the EXCEPT operation is processed.
  • If an exception output is specified to a format that contains no fields, the following occurs:
    • If an output file is specified, a record is written with default values.
    • If a record is locked, the system treats the operation as a request to unlock the record. This is the alternative form of requesting an unlock. The preferred method is with the UNLOCK operation.

For more information, see File Operations.

Figure 1. EXCEPT Operation with/without Factor 2 Specified
*...1....+....2....+....3....+....4....+....5....+....6....+....7...+....
CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq....
 *
 *  When the EXCEPT operation with HDG specified in factor 2 is
 *  processed, all exception records with the EXCEPT name HDG are
 *  written.  In this example, UDATE and PAGE would be printed
 *  and then the printer would space 2 lines.
 *  The second HDG record would print a line of dots and then the
 *  printer would space 3 lines.
 *
C                   EXCEPT    HDG
 *
 *  When the EXCEPT operation with no entry in factor 2 is
 *  processed, all exception records that do not have an EXCEPT
 *  name specified in positions 30 through 39 are written if the
 *  conditioning indicators are satisfied.  Any exception records
 *  without conditioning indicators and without an EXCEPT name
 *  are always written by an EXCEPT operation with no entry in
 *  factor 2.  In this example,  if indicator 10 is on, TITLE and
 *  AUTH would be printed and then the printer would space 1 line.
 *
C                   EXCEPT
O*
OFilename++DF..N01N02N03Excnam++++B++A++Sb+Sa+.............................
O..............N01N02N03Field+++++++++YB.End++PConstant/editword/DTformat++
O
O          E    10                     1
O                       TITLE
O                       AUTH
O          E            HDG            2
O                       UDATE
O                       PAGE
O          E            HDG            3
O                                              '...............'
O                                              '...............'
O          E            DETAIL         1
O                       AUTH
O                       VERSNO