Re: Handling changing page lengths / 4GL reports
Posted in 1992
I've resisted the temptation to join in this thread so far, but ... A. In a forthcoming release of I4GL, I am told that you will be able to use at least global variables as the page dimensions of a report; the values at the time the report is started will be used for the entire report. OUTPUT PAGE LENGTH plength LEFT MARGIN lmargin RIGHT MARGIN rmargin TOP MARGIN tmargin BOTTOM MARGIN bmargin My only additional comment is "about time too" -- the feature request database has an entry for this from way back in 1989, or thereabouts, with my name attached. Before I joined Informix, that is. B. In the code in the shell archive attached is some code that kludges its way around the problem, but only for compiled I4GL. I spent a good deal of energy trying to find a way of doing it in I4GL-RDS, and gave up in defeat. This code worked on the documented version; it seems to work for me on versions up to 4.10 without change, but cannot be guaranteed. If it doesn't work, sorry, but tough! Yours, Jonathan Leffler (johnl@obelix.informix.com) : "@(#)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: Wed Apr 22 09:53:54 GMT 1992 by johnl at Informix Software Ltd. # Files archived in this archive: # rdscurses.h # redraw.c # repdest.4gf # repdest.4gl # repdest.man # report.c # report.man # reptest.4gl # #-------------------- if [ -f rdscurses.h -a "$1" != "-c" ] then echo shar: rdscurses.h already exists else echo 'x - rdscurses.h (594 characters)' sed -e 's/^X//' >rdscurses.h <<'SHAR-EOF' X/* X @(#)rdscurses.h 1.3 90/02/09 X @(#)Termcap Curses Structure X @(#)Works for simple uses with ISQL 2.10 or I4GL 1.10 X @(#)Taken from the Nutshell Handbook `Programming with Curses' X*/ X X#ifndef TERMCAP_WINDOW X Xtypedef char bool; X Xstruct rds_win_st X{ X short _cury, _curx; X short _maxy, _maxx; X short _begy, _begx; X short _flags; X bool _clear; X bool _leave; X bool _scroll; X char **_y; X short *_firstch; X short *_lastch; X}; X X#define TERMCAP_WINDOW struct rds_win_st X Xextern TERMCAP_WINDOW *stdscr; Xextern TERMCAP_WINDOW *curscr; X X#endif /* TERMCAP_WINDOW */ SHAR-EOF chmod 444 rdscurses.h if [ `wc -c <rdscurses.h` -ne 594 ] then echo shar: rdscurses.h unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f redraw.c -a "$1" != "-c" ] then echo shar: redraw.c already exists else echo 'x - redraw.c (444 characters)' sed -e 's/^X//' >redraw.c <<'SHAR-EOF' X/* X @(#)redraw.c 1.4 90/02/09 X @(#)Informix-4GL Screen Redraw X @(#)RDS Curses Structure for ISQL 2.10 or I4GL 1.10 X @(#)Author: JL X*/ X X#include <stdio.h> X#include "rdscurses.h" X X#define clearok(win,bf) (win->_clear = bf) X#define TRUE 1 X X#ifndef lint Xstatic char sccs[] = "@(#)redraw.c 1.4 90/02/09"; X#endif X X/* X** I4GL Interface: CALL redraw_screen() X*/ Xint redraw_screen(i) Xint i; X{ X clearok(curscr, TRUE); X _winredraw(curscr); X return(0); X} SHAR-EOF chmod 444 redraw.c if [ `wc -c <redraw.c` -ne 444 ] then echo shar: redraw.c unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f repdest.4gf -a "$1" != "-c" ] then echo shar: repdest.4gf already exists else echo 'x - repdest.4gf (399 characters)' sed -e 's/^X//' >repdest.4gf <<'SHAR-EOF' X{ X @(#)repdest.4gf 2.3 90/02/08 X @(#)Sphinx Informix Tools: General Library X @(#)Form for specifying destination of report X @(#)Author: DMR X} X XDATABASE FORMONLY X XSCREEN X{ X : [f001 ] X} X XATTRIBUTES Xf001 = FORMONLY.fn TYPE CHAR, REQUIRED, X COMMENTS = "Use CONTROL-P to use the same name as last time"; XEND X XINSTRUCTIONS XDELIMITERS " " XEND SHAR-EOF chmod 444 repdest.4gf if [ `wc -c <repdest.4gf` -ne 399 ] then echo shar: repdest.4gf unpacked with wrong size fi # end of overwriting check fi #-------------------- if [ -f repdest.4gl -a "$1" != "-c" ] then echo shar: repdest.4gl already exists else echo 'x - repdest.4gl (3698 characters)' sed -e 's/^X//' >repdest.4gl <<'SHAR-EOF' X{ X @(#)repdest.4gl 2.8 91/05/17 X @(#)JLSS Informix Tools: General Library X @(#)Select destination for report X @(#)Author: JL X} X X{ X Return values of destination: X NULL => abandon report X 0 => send to screen X 1 => send to printer X 2 => send to file X 3 => send to pipe X} X XDEFINE X old_name CHAR(42) { old program/filename for CONTROL-P } XDEFINE X prv_opt CHAR(1), { Was previous option `View' } X prv_file CHAR(40) { Name of file to be viewed } X X{ Select destination for report } XFUNCTION report_destination() X X DEFINE X wrow INTEGER, X pipe_or_file CHAR(80), X destination INTEGER X X LET wrow = 2 X OPEN WINDOW w_repdest1 AT wrow, 2 X WITH 2 ROWS, 78 COLUMNS X ATTRIBUTE (BORDER) X X LET prv_opt = NULL X IF prv_file IS NOT NULL THEN X LET pipe_or_file = "rm -f ", prv_file X RUN pipe_or_file WITHOUT WAITING X LET prv_file = NULL X END IF X X MENU "REPORT DESTINATION" X X COMMAND "Screen" X "Send the report to standard output" X LET pipe_or_file = "@(#)repdest.4gl 2.8 91/05/17" { SCCS ID only } X LET destination = 0 X LET pipe_or_file = NULL X CALL set_plength(23) X CALL set_tmargin(0) X CALL set_bmargin(0) X CALL set_lmargin(0) X EXIT MENU X X COMMAND "Printer" X "Send output of report to default printer" X LET pipe_or_file = NULL X LET destination = 1 X EXIT MENU X X COMMAND KEY(F) X -- "File" X -- "Send the report to a new file (over-writes existing file)" X CALL get_pipe_or_fn(2, "F", wrow) X RETURNING pipe_or_file, destination X EXIT MENU X X COMMAND KEY(A) X -- "Append" X -- "Append the report to the end of a file (creates new file)" X CALL get_pipe_or_fn(3, "F", wrow) X RETURNING pipe_or_file, destination X LET pipe_or_file = "cat >>", pipe_or_file CLIPPED X EXIT MENU X X COMMAND "View" X "Place the report in a file and run editor on file afterwards" X LET destination = 2 X LET pipe_or_file = mkfilename("/tmp/view.XXXXXX") X LET prv_file = pipe_or_file X LET prv_opt = 'V' X EXIT MENU@