Aside from the specific platform and the compiler, suppose you have this defined in a COBOL program using Report Writer Module:
01 CF-MM TYPE CONTROL FOOTING WS-MM.
02 LINE PLUS 1.
03 COLUMN 1 VALUE "* CF MONTH: ".
03 COLUMN PLUS 1 PIC 99 SOURCE WS-MM.
03 S-MM COLUMN PLUS 5 PIC S9(4)V99 SUM WS-TUTION-PAY.
03 VAL-NN COLUMN PLUS 5 PIC S9(4)V99 SOURCE S-MM.
<...>
PROCEDURE DIVISION.
DECLARATIVES.
SEC2 SECTION.
USE BEFORE REPORTING
CF-MM.
DISPLAY "SUM MM LEVEL:" S-MM
.
Furthermore, suppose that the program reported 3 lines where SUM WS-TUTION-PAY resulted in 126.
What would be the value resulting from the statement in SEC2 SECTION that displays S-MM value? I guess it should be 126 but I am getting ZERO displayed. This maybe because the value 126 was not yet moved to S-MM, but I am not sure.
What is the value that "should" be displayed in the declaratives section for S-MM
Q: Could you reference a column in DECLARATIVES section when the column is used with SUM clause in COBOL REPORT WRITER Module?
S-MM
is adata-name
format of theentry-name
clause. Quoting from the 2002 COBOL standard, Report group description entry, 13.13.2 Syntax rules:Given that
S-MM
qualifies, it may be referenced "as a qualifier for a SUM counter".[The COBOL 74 and 85 standards stated, "Data-name-1 is optional but may be specified in any entry. Data-name-1, however, may be referenced only if the entry defines a sum counter."]
The compiler I used for the following code is Micro Focus COBOL 85.
Code:
Report:
Display: