Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Stephen T. on October 09, 2013, 10:51:26 am



Title: Page Length 0
Post by: Stephen T. on October 09, 2013, 10:51:26 am
I vaguley remember that Informix 4gl (and presumably then BDS) allowed page length 0 in a report to mean 'unlimited' page length. The page headers and trailers I think were still fired (so obvioulsy had a length). What is the Genero equivalent in a 'standard' report (ie not GRW) - is it to simply set it to some ludicrously high number?


Title: Re: Page Length 0
Post by: Gary C. on October 09, 2013, 12:48:22 pm
I've never used page length 0 but if it helps I tend to use page length 1 for non pagenated reports. This excludes the use of headers and footers but I have never needed them in a report of unknown page length.

I use this within BDL too.



Title: Re: Page Length 0
Post by: Reuben B. on October 10, 2013, 01:38:03 am
There has been a lot of tidying up in this area over recent years, particularly in relation to the generation of 4375 error at compiletime and runtime

https://4js.com/online_documentation/fjs-fgl-manual-html/User/FglErrors.html

You may find that usage of PAGE LENGTH=0 and PAGE LENGTH =1 that functioned in earlier versions doesn't in more recent versions.

I think the key is to do the maths

(PAGE LENGTH - TOP MARGIN - BOTTOM MARGIN) >= Number of PRINT's per page.





Title: Re: Page Length 0
Post by: Stephen T. on October 10, 2013, 10:52:42 am
G/Reuben,
Thanks. I thought though that LENGTH 0 was an Informix 'special' case - in that it produced a first page header (not defined as first, but just triggered on 1st page) and then just the 'stream'. If you use other lengths as the page, do you not get the page header repeating? No great issue to work around - maybe a bit trickier to spot though as it seems the page length is being passed via a variable.

 


Title: Re: Page Length 0
Post by: Stephen T. on October 16, 2013, 09:20:28 am
... I have a report that does have the page length set to a silly length (in this case 65500 - presumably to work within Excel's limits) - and this still fails with a -4375 - BUT if the page length is reduced to 66, it doesn't come up with the same error. The report has a first page header of two lines (date line and headings) and a 'last row' of two lines. 0 margins top and left.


Title: Re: Page Length 0
Post by: Stephen T. on October 16, 2013, 09:30:47 am
... I have a report that does have the page length set to a silly length (in this case 65500 - presumably to work within Excel's limits) - and this still fails with a -4375 - BUT if the page length is reduced to 66, it doesn't come up with the same error. The report has a first page header of two lines (date line and headings) and a 'last row' of two lines. 0 margins top and left.

OK - is the page length a smallint and anything above the magic 32k number treated as negative by any chance?



Title: Re: Page Length 0
Post by: Reuben B. on October 16, 2013, 10:32:31 pm
Don't you end up with lots of blank lines at the end of your report file using PAGE LENGTH set to a "silly length"?

If you are creating a CSV file that can be opened automatically in Excel, why don't use you use base.Channel to write the file.  Something like ...

Code
  1. LET ch = base.Channel.create(filename,"w")
  2. CALL ch.setDelimiter("CSV")
  3. CALL ch.writeLine(heading_line1())
  4. CALL ch.writeLine(heading_line2())
  5. FOREACH data_curs INTO rec.*
  6.   CALL ch.write(rec.*)
  7. END FOREACH
  8. CALL ch.writeLine(footer_line1())
  9. CALL ch.writeLine(footer_line2())
  10. CALL ch.close()



Title: Re: Page Length 0
Post by: Stephen T. on October 17, 2013, 08:34:14 am
Reuben,,
Mainly because this is a migration from BDS, and the code for reports hadn't been identified as a migration issue. Page length 0 'works' in BDS as I recall it used to in Informix (but my memory fades - and I don't recall whether page length 0 was an intentional feature or a bug that people manipulated.
I can convert the reports to Channel (and to be honest that was my first thought), but its a bit more work (as I've seen some reports pass the page length to the report and use the report in two 'modes') that hasn't been catered for in a shortish deadline. So i was hoping that 'page length 0' should also work in Genero and that it was maybe a setting that I'd missed!

Steve


Title: Re: Page Length 0
Post by: Reuben B. on October 18, 2013, 01:11:37 am
Quote
Page length 0 'works' in BDS as I recall it used to in Informix (but my memory fades ...

Create an example that shows PAGE LENGTH 0 working as you expect it to using Informix or BDS.  There is a saying I came across once, "nothing spins a geeks propellor like an isolatable reproducible problem".  So if you can create a small program that compiles and runs differently in Informix-4gl, BDS, Genero then that will grab our developers attention.

The problem for us will be if it does A in Informix-4GL, and B in BDS, what do we do in Genero, A or B?, or do we add an FGLPROFILE setting similar to Report.aggregateZero?  In this instance, if what you say is correct, an FGLPROFILE setting that says ignore error 4375 if PAGE LENGTH=0 might be the way forward.

Reuben





Title: Re: Page Length 0
Post by: Stephen T. on October 18, 2013, 08:45:09 am
Cheers Reuben
The problem is that the project is a migration that has already been scoped, and PAGE LENGTH 0 wasn't identified as an issue - its not that I want to use PAGE LENGTH 0, I just wanted to know if the 'old' functionality had been migrated in a way that I was unaware of.
If it hasn't then the migration will have to handle it a different way, as I don't think there's time to wait for a fix.



Title: Re: Page Length 0
Post by: Reuben B. on October 21, 2013, 05:45:00 am
Stephen,

I did a search on "PAGE LENGTH 0" in the Issue Tracker https://4js.com/en/support/issue/?id=&product=&stat=&words=%22PAGE+LENGTH+0%22&Search=Search and it lists a very old issue that involved PAGE LENGTH 0.  It has a nice small example and I tried compiling/running that example in a few versions.  It compiles and runs in 2.11, 2.21, 2.30, in 2.40 it compiles but doesn't run, and in 2.50 it fails to compile or run.  Where it fails it lists the -4375 error I mentioned earlier.

Compiling and running on BDS it succeeds, compiling and running on Informix-4gl it has a -4375 compile time error.

In our documentation, we mention this new error -4375 as a migration issue for 2.40 https://4js.com/online_documentation/fjs-fgl-manual-html/User/Mig0006.html#invalid_report_dimensions.  If there was a simple workaround I would expect it to be listed there.

Reuben




Title: Re: Page Length 0
Post by: Stephen T. on October 21, 2013, 08:49:01 am
Thanks Reuben - I did see that issue as it appeared on a general 'Page Length 0' serach on google - but it seemed to me to be more focuesd on the array item than the PAGE LENGTH setting. It also appeared on a copule of forums in connection with Informix 4gl and Ace.

But again, all that is largely irrelevant as if there's not 'the same' way in Genero to handle what the BDS prog was doing, then it will have to be coded round anyway.

Thanks again,

Steve


Title: Re: Page Length 0
Post by: Olivier E. on October 21, 2013, 12:13:33 pm
Hello Stephen,


   Let see the issue :

https://4js.com/en/support/issue/?id=23068&product=&stat=&words=%22PAGE+LENGTH+0%22&Search=Search

  There is a workaround : Modify your reports with :   BOTTOM MARGIN  0  + PAGE LENGTH 1  - See attachment


Olivier E. - Four Js Support


Title: Re: Page Length 0
Post by: Stephen T. on October 21, 2013, 05:42:40 pm
Olivier,
Thanks for pointing me at that. In 2.40, the 0's in the length,bottom and top margin still cause a failure at runtime and 1 doesn't 'globally' work for the code here - it looks like the calc presented above is the way for the moment - ie to set the page length to the no of lines on every row + any headings + any trailers

Steve


Title: Re: Page Length 0
Post by: Reuben B. on October 21, 2013, 11:00:50 pm
Olivier: In the Bugzilla comments for 23068 there is an entry that says "Erratum in main Description: PAGE LENGTH must be set to 1, not 0". hence I would not expect that to help us here.

What that issue related to was the fact that with the -4375 test, if TOP MARGIN/BOTTOM MARGIN were not defined, then the default of 3 was used.  Hence if you had PAGE LENGTH 1 and hadn't explicitly set TOP MARGIN 0, BOTTOM MARGIN 0 then the -4375 calculation was always going to fail.


Title: Re: Page Length 0
Post by: Rene S. on October 22, 2013, 10:20:20 am
Hello, this topic begins with "I vaguley remember that Informix 4gl"...
Recent versions of Infomix c4gl raise  error -4375: "The page length is too short to cover the specified page header and  trailer lengths." when setting PAGE LENGTH to 0.
I remember differently: the BDS compiler was in some cases not as strong as the Infomix compiler. As an unexpected result, programmers could code "PAGE LENGT 0". 

I did a quick test with BDS 3.55.01.46. When setting PAGE LENGHT to 0 then every PRINT in ON EVERY ROW is surrounded by a PAGE HEADER and a PAGE TRAILER. Stephen, this is obviously not what you describe. BDS does not interpret 0 as infinite.

You can suppress empty lines at the end of the REPORT by setting the OUPUT option TOP OF PAGE "\f". This only helps when not having a PAGE TRAILER. BTW: yes, PAGE LANGTH is type of SMALLINT.

Stephen, please attach a simple example program + the generated output. Perhaps we can propose a solution after analyzing this example.

Rene

 



Title: Re: Page Length 0
Post by: Stephen T. on October 22, 2013, 11:33:29 am
Rene,
Apologies - the Informix reference was very vague - but I was talking about 15+ years back (I can't even recall the 4gl version) - not any recent version (I don't think I'm going mad either as I did google page length 0 and found posts on the IIUG (http://www.iiug.org/forums/classics/index.cgi/noframes/read/1573) and 'elsewhere' infering that certain version  of 4gl did have a similar 'feature' (or bug!) (http://www.databaseteam.org/6-informix/6931fb85106c3371.htm).

Anyway, this 'tester' code is all that is required to produced the attached output (this is not the full 1.3MB of the output - but the dates simply repeat with no spacing until the 'trailer' text) under BDS 3.55.01.40. Ignore the dialog bit - I was using that to show the effect of INT_FLAG.
MAIN
 DEFINE l_char                  CHAR(1),
        l_i                     INTEGER

 WHENEVER ANY ERROR CONTINUE
   
    START REPORT r_report TO PRINTER

    FOR l_i = 1 TO 70000
        OUTPUT TO REPORT r_report(TODAY+l_i)
    END FOR

    FINISH REPORT r_report


    LET INT_FLAG        = FALSE
    DISPLAY '(',FGL_GETRESOURCE('gui.uiMode'),')'

    WHILE TRUE
        MENU 'Hello'
            COMMAND 'One' 'Command One'
                DISPLAY 'One'

            COMMAND 'Two' 'Command Two'
                DISPLAY 'Two'

            COMMAND KEY(F5)
                DISPLAY 'F5 Pressed'
        END MENU
        DISPLAY 'INT_FLAG (',INT_FLAG,')'
    END WHILE
 END MAIN   



 REPORT r_report(p_date)
 DEFINE p_date                  DATE

 OUTPUT
    LEFT    MARGIN  0
    RIGHT   MARGIN  0
    TOP     MARGIN  0
    BOTTOM  MARGIN  0
    PAGE    LENGTH  0
     
 FORMAT
    FIRST PAGE HEADER
        PRINT 'This is a file extract'

    ON EVERY ROW
        PRINT COLUMN 1,'Date ', p_date USING 'dd mmm yyyy'

    ON LAST ROW
        PRINT 'Thie is the end of the data'
       
 END REPORT


As I was saying to Seb on the INT_FLAG front, if there is no equivalent in Genero, then that is no great issue - I just thought that I had missed settings. The project here is running on a 2.4 release anyway and needs to be in within the next two months, so there's no time to wait for a leter release of Genero - and I think I can get around the issue by individually working each report's layout that has this 'feature'.