Understanding the Generated Code (Unpaged Controls)

Although the code generated for each control type is different, based on the unique characteristics of the control, the code generated for each of the unpaged controls is very similar. The first example shows the code generated into the Procedure Division (.prd) COPY file for a grid control that takes its data from a data file called clients. The second example shows the code skeleton from which the first sample was generated.

Generated Code Sample: Grid

MOVE LOW-VALUE TO cl-client-id.
START clients, KEY >= cl-client-id
   INVALID KEY
      PERFORM Invalid-Key-Paragraph
END-START.
PERFORM UNTIL NOT valid-clients
   READ clients NEXT RECORD
      AT END
         PERFORM At-End-Paragraph
      NOT AT END
         IF 2>1
            PERFORM Not-At-End-Paragraph
         END-IF
   END-READ
END-PERFORM.
MODIFY clients-gd, MASS-UPDATE = 0.

Generated Code Skeleton: Grid

MOVE [Start Value / Variable] TO [Start Key].
START [Filename], KEY [Start Direction] [Start Key]
   INVALID KEY
      PERFORM [Invalid Key Perform]
END-START.
PERFORM UNTIL [Perform Until Condition] [End Value / Variable]
   READ [Filename] [Read Direction]
      AT END
         PERFORM [At End Perform]
      NOT AT END
         IF [At Item Condition]
            PERFORM [Not At End Perform]
         END-IF
   END-READ
END-PERFORM.
MODIFY [Control-Name], MASS-UPDATE = 0.