#75 2.1: PAGE LIMITS causes broken report

unclassified
closed
Ron Norman
None
6
2014-07-28
2014-06-08
Edward Hart
No

Take the following program:

       >>SOURCE FREE
IDENTIFICATION DIVISION.
PROGRAM-ID. report-test.

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
    SELECT report-file ASSIGN "listing.txt"
        ORGANIZATION LINE SEQUENTIAL.

DATA DIVISION.
FILE SECTION.
FD  report-file REPORT rp.

WORKING-STORAGE SECTION.
01  foo  PIC X(30).

REPORT SECTION.
RD  rp PAGE LIMIT 3 LINES.

01  rp-detail TYPE DE.
    03  LINE + 1, COL 01; SOURCE foo, PIC X(30).

PROCEDURE DIVISION.
    OPEN OUTPUT report-file
    INITIATE rp

    MOVE "hello" TO foo
    GENERATE rp-detail

    MOVE "goodbye" TO foo
    GENERATE rp-detail

    TERMINATE rp
    CLOSE report-file
    .
END PROGRAM report-test.

This is the expected output:

hello
goodbye

But instead I just get "hello" followed by 5 blank lines. Removing the PAGE LIMIT clause causes the correct report to be generated.

cobc -info:

cobc (GNU Cobol) 2.1.0
Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida
Copyright (C) 2006-2012 Roger While
Copyright (C) 2013 Ron Norman
Copyright (C) 2009,2010,2012,2014 Simon Sobisch
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Built     Jun 07 2014 19:27:45
Packaged  Nov 23 2013 07:02:31 UTC
C version "4.8.2"

Build information
Build environment        : x86_64-unknown-linux-gnu
CC                       : gcc -std=gnu99
CPPFLAGS                 : 
CFLAGS                   : -O2 -pipe -finline-functions -fsigned-char
                           -Wall -Wwrite-strings -Wmissing-prototypes
                           -Wno-format-y2k -U_FORTIFY_SOURCE
LD                       : /usr/bin/ld -m elf_x86_64
LDFLAGS                  : -Wl,-z,relro,-z,now,-O1

GNU Cobol information
COB_CC                   : gcc -std=gnu99
COB_CFLAGS               : -I/usr/local/include -pipe
COB_LDFLAGS              : 
COB_LIBS                 : -L/usr/local/lib -lcob -lm -lgmp -lncursesw
                           -ldb -ldl
COB_CONFIG_DIR           : /usr/local/share/gnu-cobol/config
COB_COPY_DIR             : /usr/local/share/gnu-cobol/copy
COB_MODULE_EXT           : so
COB_EXEEXT               : 
Dynamic loading          : System
"CBL_" param check       : Disabled
Variable format          : 0
BINARY-C-LONG            : 8 bytes
Sequential handler       : Internal
ISAM handler             : BDB

Discussion

  • Simon Sobisch
    Simon Sobisch
    2014-06-10

    Thank you for reporting this bug. Accepted and assigned to Ron Norman.

    @Ron: Please add a PAGE LIMITS test case to the test suite, checking if PAGE LIMITS work in both cases (report doesn't reach the limit, report has two lines more).

    Simon

     
  • Simon Sobisch
    Simon Sobisch
    2014-06-10

    • status: open --> accepted
    • assigned_to: Ron Norman
    • Priority: 1 --> 6
     
  • Simon Sobisch
    Simon Sobisch
    2014-06-16

    The bug seems to be fixed (at least the expected output data is in the report and test cases were added) but I'm not sure if current version is really correct. How many blank lines should be in the report? I the current behaviour correct?

    @Ron: Please have a look at this when including the test cases for the non-fatal exception PAGE LIMIT overflow (run_syntax.at). Thank you.

    Simon

     
    • Ron Norman
      Ron Norman
      2014-06-16

      I think you may be right. Let me have a closer look at the reportio.c
      module.
      I had just focused on the line not getting printed.

      --
      Cheers
      Ron Norman

       
      Last edit: Simon Sobisch 2014-06-16
      Attachments
  • Simon Sobisch
    Simon Sobisch
    2014-06-16

    Hi Ron,

    as this exception is non-fatal nothing happens (we may could trow a
    runtime warning within cob_set_exception in this case).

    The thing that should be different is that you get something with the
    FUNCTION EXCEPTION-..., for samples see
    http://opencobol.add1tocobol.com/gnucobol/gcfaq.html#function-exception-status.

    Simon

     
    • Ron Norman
      Ron Norman
      2014-06-17

      I will post my new code changes tomorrow.

      --
      Cheers
      Ron Norman

       
      Last edit: Simon Sobisch 2014-06-17
      Attachments
  • Simon Sobisch
    Simon Sobisch
    2014-06-19

    • status: accepted --> closed
     
  • Simon Sobisch
    Simon Sobisch
    2014-06-19

    Fixed by Ron in svn, closing this bug as solved.