Multiple CONDITION Command: Correct Solution

The example in Figure Example of CORRECT Solution differs from the example in Figure Example of INCORRECT Solution in two significant ways:

  • Because the page format for the back side is the first one defined in the page definition, it is the one that is initially active
  • Both CONDITION commands (NEWREP and SHIFTIT) specify that the action should happen before the current subpage has been processed

When processing begins, condition NEWREP fails because this is a WHEN CHANGE condition and the page format has just been started. However, condition SHIFTIT returns a true result, and the NEXT page format (PFFRONT) is started. No lines have been formatted, so condition SHIFTIT has the effect of moving to the page format for the front side.

Example of CORRECT Solution

FORMDEF XMPCOR OFFSET 0 0 DUPLEX RTUMBLE JOG YES REPLACE YES;
  COPYGROUP CG1;
        OVERLAY OVLY1;
        OVERLAY OVLY2;
        SUBGROUP       OVERLAY OVLY1 FRONT;
        SUBGROUP       OVERLAY OVLY2 BACK ;
 
PAGEDEF XMPCOR REPLACE YES;
        FONT GT24;
        FONT GT12;
        /* The pageformat for the back side of the form is  */
        /* the first pageformat in the PAGEDEF.  Therefore, */
        /* it will initially be the active pageformat       */
        PAGEFORMAT PFBACK WIDTH 8.5 IN HEIGHT 11 IN DIRECTION ACROSS;
SETUNITS 1 PELS 1 PELS LINESP 8 LPI;
          PRINTLINE REPEAT 1 CHANNEL 1 FONT GT12 POSITION 75 61;
          CONDITION NEWREP START 8 LENGTH 3
            WHEN CHANGE BEFORE SUBPAGE COPYGROUP CG1 PAGEFORMAT
            PFFRONT;
          CONDITION SHIFTIT START 1 LENGTH 1
            WHEN GE X'00' BEFORE SUBPAGE NULL NEXT;
          PRINTLINE REPEAT 40 FONT GT12 POSITION 75 NEXT;
          ENDSUBPAGE;
 
          PRINTLINE REPEAT 1 CHANNEL 1 FONT GT12 POSITION 75 1335;
          CONDITION NEWREP START 8;
          PRINTLINE REPEAT 40 FONT GT12 POSITION 75 NEXT;
          ENDSUBPAGE;
 
        /* This is the pageformat for the front side of the form. */
        PAGEFORMAT PFFRONT WIDTH 11 IN HEIGHT 8.5 IN DIRECTION UP;
SETUNITS 1 PELS 1 PELS LINESP 16 LPI;
          PRINTLINE REPEAT 1 CHANNEL 1 FONT GT23 POSITION 75 188;
          CONDITION NEWREP START 8;
          CONDITION SHIFTIT START 1;
          PRINTLINE REPEAT 40 FONT GT24 POSITION 75 NEXT;
          ENDSUBPAGE;
 
          PRINTLINE REPEAT 1 CHANNEL 1 FONT GT24 POSITION 1377 188;
          CONDITION NEWREP START 8;
          PRINTLINE REPEAT 40 FONT GT24 POSITION 1377 NEXT;
          ENDSUBPAGE;
 
          PRINTLINE REPEAT 1 CHANNEL 1 FONT GT24 POSITION 75 1102;
          CONDITION NEWREP START 8;
          PRINTLINE REPEAT 40 FONT GT24 POSITION 75 NEXT;
          ENDSUBPAGE;
 
          PRINTLINE REPEAT 1 CHANNEL 1 FONT GT24 POSITION 1377 1102;
          CONDITION NEWREP START 8;
          PRINTLINE REPEAT 40 FONT GT24 POSITION 1377 NEXT;
          ENDSUBPAGE;