The FAQ Appendix 1.4 - Diff pdate from 1.3
Posted in 1994
Here's the diff to upgrade your 1.3 Appendices file to 1.4. As per the previous post: Does *anybody* think this post is worthwhile? Regards, Kerry S ------------------------------ Cut here ----------------------------------- 1c1 < $Id: informix.apx,v 1.3 1994/09/05 11:58:36 kerry Exp $ --- > $Id: informix.apx,v 1.4 1994/11/09 10:31:38 kerry Exp $ 194c194 < --- > kerry@kcbbs.gen.nz 1569,1571c1569,2292 < _____________________________________________________________________________ < Any opinions expressed herein are my own and not those of my employers. < _____________________________________________________________________________ --- > > ---------------------------------------------------------------------------- > APPENDIX J Dynamically Changing Report OPTIONs > ---------------------------------------------------------------------------- > > >How do you handle changing the report OUTPUT parameters at runtime (PAGE > >LENGTH, TOP MARGIN, BOTTOM MARGIN, etc.)? What I'd like to be able to do > >is to pass it a page length/width into a subroutine and then be able to > >calculate a reasonable PAGE LENGTH, and MARGINs. > > There is not yet any Informix-supported way to dynamically size reports in > Informix-4GL. However, there is an alternative solution which is, I believe, > in the FTP archives at rmy.emory.edu. It is also reproduced in Appendix J. > > I developed the c-code version; Marlin Prowell took what I'd produced, did > some detective work and adapted it to work with the p-code runners. The > major deficiency of the solution is that you cannot change the top margin > on the first page of the report. The attached shell archive contains a > manual page as well as the necessary code. Despite the disclaimer at the > bottom of the manual page, there is no version of I4GL where the code would > break that I know of. That, however, cannot be construed as saying it will > definitely always work everywhere -- for example, I have not tested it on > any 64-bit machines, and I'd not be surprised to find that the padding in > the p-code report structure changed size on 64-bit machines. > > Yours, > Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> > > : "@(#)shar.sh 1.8" > #! /bin/sh > # > # This is a shell archive. > # Remove everything above this line and run sh on the resulting file. > # If this archive is complete, you will see this message at the end: > # "All files extracted" > # > # Created: Fri Jul 24 11:43:14 GMT 1992 by johnl at Informix Software Ltd. > # Files archived in this archive: > # report.man > # report.c > # rejig.4gl > # > #-------------------- > if [ -f report.man -a "$1" != "-c" ] > then echo shar: report.man already exists > else > echo 'x - report.man (4043 characters)' > sed -e 's/^X//' >report.man <<'SHAR-EOF' > X'\\" @(#)report.man 1.4 92/07/24 > X'\\" @(#)Manual page: General Library -- Report Configuration > X.ds fC "report.man 1.4 92/07/24 > X.TH REPORT 3S "JLSS Informix Tools" > X.SH NAME > Xset_output \\(em Dynamically reconfigure dimensions of I4GL report > X.SH SYNOPSIS > X.ft B > Xfunction set_plength(i) > X.br > Xdefine i integer > X.sp > Xfunction set_tmargin(i) > X.br > Xdefine i integer > X.sp > Xfunction set_bmargin(i) > X.br > Xdefine i integer > X.sp > Xfunction set_lmargin(i) > X.br > Xdefine i integer > X.sp > Xfunction set_rmargin(i) > X.br > Xdefine i integer > X.sp > Xfunction set_output() > X.ft R > X.ft B > Xfunction get_plength() > X.sp > Xfunction get_tmargin() > X.sp > Xfunction get_bmargin() > X.sp > Xfunction get_lmargin() > X.sp > Xfunction get_rmargin() > X.ft R > X.SH DESCRIPTION > XThese functions can be used to dynamically reconfigure the layout > Xof the page of an Informix 4GL report. > XThe example program shown below illustrates how they should be used. > X.br > X.ft CW > X.ps 10 > X.vs 12 > X.nf > X.so rejig.4gl > X.br > X.fi > X.ft > X.ps > X.vs > XThe functions \\fIset_plength\\fP, \\fIset_tmargin\\fP, > X\\fIset_bmargin\\fP, \\fIset_lmargin\\fP and \\fIset_rmargin\\fP may be called > Xanywhere inside an I4GL program. > XThe function \\fIset_output\\fP will have no effect except within a report. > XIt is recommended that \\fIset_output\\fP be used in the \\s-2FIRST > XPAGE HEADER\\s0 control block, but it may be used in any control block. > X.P > XAfter the function \\fIset_output\\fP is called, it invalidates all the settings; > Xto change the settings in a second report, you must call the > Xset-routines again. > XThere is no requirement that all the routines are called (or even any of them). > X.P > XThe functions \\fIget_plength\\fP, \\fIget_tmargin\\fP, > X\\fIget_bmargin\\fP, \\fIget_lmargin\\fP and \\fIget_rmargin\\fP may be called > Xanywhere inside an I4GL program. > XIf page dimensions have been set using the set-routines, then the corresponding > Xvalue is returned; otherwise, the corresponding default value is returned. > XAfter \\fIset_output\\fP has been called, the values returned will be > Xthe default values again; if your report needs to know what its dimensions will > Xbe, it should use the get-routines before calling \\fIset_output\\fP. > X.SH COMPILATION > XIf compiling for use with compiled Informix-4GL, no special flags are needed. > XIf compiling for use with I4GL-RDS, include -DI4GL_RDS on the command line. > XThe details of building the functions into the \\*Cfglgo\\*D > Xand \\*Cfgldb\\*D are given in the corresponding Informix manuals. > XThe necessary definitions for \\*cfgiusr.c\\*d are: > X.br > X.ft CW > X.ps 10 > X.vs 12 > X.nf > X#ifdef SET_REPORT > Xextern int set_output(); /* 0 */ > Xextern int get_rmargin(); /* 0 */ > Xextern int get_tmargin(); /* 0 */ > Xextern int get_bmargin(); /* 0 */ > Xextern int get_lmargin(); /* 0 */ > Xextern int get_plength(); /* 0 */ > Xextern int set_rmargin(); /* 1 */ > Xextern int set_tmargin(); /* 1 */ > Xextern int set_bmargin(); /* 1 */ > Xextern int set_lmargin(); /* 1 */ > Xextern int set_plength(); /* 1 */ > X#endif /* SET_REPORT */ > X > X#ifdef SET_REPORT > X { "set_output", set_output, 0 }, > X { "get_rmargin", get_rmargin, 0 }, > X { "get_tmargin", get_tmargin, 0 }, > X { "get_bmargin", get_bmargin, 0 }, > X { "get_lmargin", get_lmargin, 0 }, > X { "get_plength", get_plength, 0 }, > X { "set_rmargin", set_rmargin, 1 }, > X { "set_tmargin", set_tmargin, 1 }, > X { "set_bmargin", set_bmargin, 1 }, > X { "set_lmargin", set_lmargin, 1 }, > X { "set_plength", set_plength, 1 }, > X#endif /* SET_REPORT */ > X.br > X.fi > X.ft > X.ps > X.vs > X.SH WARNINGS > XThis code was designed and tested on an ATT&T 3B2/400 running > XUNIX System V Rel