SOURCE

Map Data Division items to output fields. Batch environments.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

Syntax:

SOURCE [IS] dataname [iterativeexpression] [PIC 
picclause]
    [BLANK [WHEN] ZERO]
    [CHANGE INDICATE|GROUP INDICATE]
    [JUSTIFIED|JUST [RIGHT]
    [DATA-NAME [IS] fieldname]

Parameters:

BLANK WHEN ZERO Print spaces when SOURCE dataname is zero. COBOL usage rules apply.
CHANGE INDICATE Print value of SOURCE dataname whenever it changes. See also Considerations below..
DATA-NAME fieldname Name a sum accumulator established by a SUM or REFERENCE clause. Do not define fieldname in Working-Storage. At generation, AMB inserts fieldname after the level number in the generated report group. DATA-NAME moves the value of the internal SUM accumulator to fieldname.

Code the DATA-NAME clause when a SUM UPON clause references DETAIL report group, when the program references a sum accumulator, or when a sum accumulator requires a data name for qualification.

dataname Data item being referenced; can be report mock-up field or a Working-Storage field.
GROUP INDICATE Identify an item, such as a header, that prints on the first occurrence of its report group after a control break or a page advance. You can use GROUP INDICATE when a DETAIL type defines a printable item; specify GROUP INDICATE for elementary items. If the RED keyword does not contain a PAGE or a CONTROL clause, a GROUP INDICATE item prints the first time its DETAIL line prints after INITIATE processing.
iterative expression Generate multiple SOURCE statements for suffixed data items or elements of an array.
JUSTIFIED RIGHT Right justify the field value. COBOL usage rules apply.
PIC picclause Specify the format of dataname. If dataname is a report mock-up field instead of a Working-Storage field, the next matching COBOL picture in the report mock-up is the picclause for dataname.

Comments:

  • SOURCE immediately follows the MOCKUP or OVERPRINT clause.
  • SOURCE designates that the item is described in the program Data Division, is the special Report Writer register LINE-COUNTER or PAGE-COUNTER, or is the internal sum accumulator established by Report Writer.
  • In CONTROL FOOTING, PAGE HEADING, PAGE FOOTING, and REPORT FOOTING report groups, SOURCE cannot reference controls or data items referencing controls.
  • To map PAGE-COUNTER (or LINE-COUNTER) when there is more than one report in a program, code PAGE-COUNTER OF reportname.
  • In a DETAIL type entry, use CHANGE INDICATE instead of GROUP INDICATE to suppress printing the item after a page break.

Examples:

 01    DETAIL-LINE TYPE IS DETAIL.
       MOCKUP LINE 16
       SOURCE WS-LOCATION-CODE    GROUP INDICATE
       SOURCE WS-LAST-COUNT-MONTH PIC 99
       SOURCE WS-LAST-COUNT-DAY   PIC 99
       SOURCE WS-LAST-COUNT-YEAR  PIC 99
       SOURCE WS-QTY-IN-STOCK     JUSTIFIED RIGHT
       SOURCE WS-QTY-ISSUED       JUSTIFIED RIGHT
       SOURCE WS-QTY-RECEIVED     JUSTIFIED RIGHT
       REFERENCE WS-NO-OF-SALES   PIC 9999