Menu

REPORT WRITER-DECLARTIVES-BEFORE REPORTING DETAIL - How to make it work?

Emmad
2021-07-01
2021-07-04
  • Emmad

    Emmad - 2021-07-01

    I have a program that uses the Report Writer module. The program works and writes the expected output. However, the DECLARATIVES don't seam to get executed. I mean the DISPLAY does not show and the value of the WS-X field in the detail is never set to "*" as specified in the Declaratives.

    Is the code in the DECLARTIVES executed before printing detail group or is it only for control breaks and IO exceptions?

    This all is a part of my learning. Thanks for helping.

    I am using GNU COBOL 3.1.2.0 on Windows 10.

    *************** other code here *****************
    
    01  REPORT-1A-DETAIL
                   TYPE DETAIL LINE.
                   .
                   02 D1 LINE  PLUS 2.
    
                       03 COLUMN  3                     PIC X(1)     
                                  SOURCE WSI-A. 
                       03 COLUMN PLUS 2                 PIC X(1)     
                                  SOURCE WSI-B.
                       03 COLUMN PLUS 2                 PIC X(1) 
                                 SOURCE WSI-C.
                       03 COLUMN PLUS 2                 PIC 9(1) 
                                 SOURCE WSI-V.
                       03 COLUMN PLUS 2                 PIC X
                                 SOURCE WS-X.
    
                       03 COLUMN 77                     PIC 9(3) 
                                 SOURCE LINE-COUNTER.        
          *> --------------------------------------------------------------
           PROCEDURE DIVISION.
           DECLARATIVES.
    
           BEFORE-DETAIL   SECTION.
               USE BEFORE REPORTING REPORT-1A-DETAIL.
           PARA-1.     
               DISPLAY   "1- " LINE-COUNTER        UPON CONSOLE
               DISPLAY   "2- " WS-INPUT-RECORD     UPON CONSOLE
               MOVE "*" TO WS-X
               .
           END DECLARATIVES.
    
                       MOVE FUNCTION CURRENT-DATE TO WS-DATE.
                       OPEN OUTPUT PRINT-FILE.
    .................... other code......................
                                         GENERATE REPORT-1A-DETAIL
    .................... other code......................
    
     

    Last edit: Emmad 2021-07-01
    • Vincent (Bryan) Coen

      Assuming you are using GC 3.1.2 or there abouts try adding after the
      displays a
      STOP "Check vdu O/P".

      Now see if that appears - it is possible that the screen has cleared
      after EOR.

       

      Last edit: Vincent (Bryan) Coen 2021-07-03
      • Emmad

        Emmad - 2021-07-02

        Thank you for your help. I tried adding:
        STOP "Check vdu O/P".
        But It still does not display. If I use display outside DECLARTIVES, the display result show.

         
      • Emmad

        Emmad - 2021-07-02

        Thank you for your help. I tried adding:
        STOP "Check vdu O/P".
        But It still does not display. If I use display outside DECLARTIVES, the display result show.

         
  • Vincent (Bryan) Coen

    Please confirm what version of the compiler you are using BUT it would appear that the declarative is NOT being executed.

    It might be worth while to retest having turned on tracing and debug by running :

    cobc -x progname.cbl -d -g -ftraceall

    Then :

    export COB_SET_TRACE=YES
    export COB_TRACE_FILE=/home/{username}/trace.log

    now run the program and after look in the file trace.log and see if the declarative has run having checked that you have a valid report file.

     
    • Emmad

      Emmad - 2021-07-03

      Thank you for the idea and the detailed description.
      I am using GNU COBOL 3.1.2.0 on Windows 10.
      I did what you suggested and I guess the declaratives are not executed as you said - here is the output

      Program-Id:  PROG1
      Program-Id:  PROG1                Entry: PROG1                           Line:    149
      Program-Id:  PROG1                       MOVE                            Line:    164
      Program-Id:  PROG1                       OPEN                            Line:    165
      Program-Id:  PROG1                       INITIATE                        Line:    167
      Program-Id:  PROG1                       PERFORM                         Line:    168
      Program-Id:  PROG1            Paragraph: DO-REPORTING                    Line:    173
      Program-Id:  PROG1                       MOVE                            Line:    174
      Program-Id:  PROG1                       GENERATE                        Line:    175
      Program-Id:  PROG1                       MOVE                            Line:    177
      Program-Id:  PROG1                       GENERATE                        Line:    178
      Program-Id:  PROG1                       MOVE                            Line:    180
      Program-Id:  PROG1                       GENERATE                        Line:    181
      ....
      Program-Id:  PROG1                       MOVE                            Line:    198
      Program-Id:  PROG1                       GENERATE                        Line:    199
      Program-Id:  PROG1                       TERMINATE                       Line:    169
      Program-Id:  PROG1                       CLOSE                           Line:    170
      Program-Id:  PROG1                       MOVE                            Line:    171
      Program-Id:  PROG1                       STOP RUN                        Line:    172
      
       

      Last edit: Emmad 2021-07-04
      • Vincent (Bryan) Coen

        Agreed it is not being executed.

        Suggest you report it as a Bug via the Bug tracker but make sure you
        specify the exact version of the compiler and platform you are using.

        On 03/07/2021 22:09, Emmad wrote:

        Thank you for the idea and the detailed description. I did what you
        suggested and I guess the declaratives are not executed as you said -
        here is the output

        Program-Id:PROG1
        Program-Id:PROG1 Entry:PROG1 Line:149
        Program-Id:PROG1 MOVE Line:164
        Program-Id:PROG1 OPEN Line:165
        Program-Id:PROG1 INITIATE Line:167
        Program-Id:PROG1 PERFORM Line:168
        Program-Id:PROG1 Paragraph:DO-REPORTING Line:173
        Program-Id:PROG1 MOVE Line:174
        Program-Id:PROG1 GENERATE Line:175
        Program-Id:PROG1 MOVE Line:177
        Program-Id:PROG1 GENERATE Line:178
        Program-Id:PROG1 MOVE Line:180
        Program-Id:PROG1 GENERATE Line:181
        ....
        Program-Id:PROG1 MOVE Line:198
        Program-Id:PROG1 GENERATE Line:199
        Program-Id:PROG1 TERMINATE Line:169
        Program-Id:PROG1 CLOSE Line:170
        Program-Id:PROG1 MOVE Line:171
        Program-Id:PROG1 STOP RUN Line:172

         
      • Emmad

        Emmad - 2021-07-04

        Will do - Thank you.

         

Anonymous
Anonymous

Add attachments
Cancel