Re: DBPRINT variable
Posted in 1992
Quoting Ruchi Patel... > > I have a 4gl program that prints the report directly to printer. It always > used to print on only one printer. I have a shell script that defines the > DBPRINT="lp -d lp1a". This works fine. Now we have a more than one printer. > So, user should be able to select the printer. How can I reset the DBPRINT > variable in 4gl program? I tried to run the shell script using the RUN > command in 4gl. Shell script looks like the following. > > PRINTER=lp2; export PRINTER > DBPRINT="lp -d lp2"; export DBPRINT > Ruchi, when you RUN a shell script from a 4GL program this is what happens: RUN spawns a new shell process The shell runs your script Your scripts changes the values of variables in the current shell The shell (with the new values) dies and you return to 4GL What I would do is something like this: DEFINE printer_type CHAR(32) MENU "PRINTER" COMMAND "Wide Printer" "Line printer (132)" LET printer_type = "lp -d lp1" EXIT MENU COMMAND "Narrow Printer" "Line printer (80)" LET printer_type = "lp -d lp2" EXIT MENU COMMAND "Laser Printer" "LaserJet" LET printer_type = "lp -d lp3" EXIT MENU END MENU START REPORT my_report TO PIPE printer_type ... ... ... DAS -- David A. Snyder @ Snide Inc. - Folcroft, PA Current Release is db4glgen-3.4 UUCP: ..!uunet!das13!dave INTERNET: Dave.Snyder@snide.com