Re: report printing with d4gl on NT
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Thanks for the tip. We also dug around and thought of using the d4gl extension... winexec(cmd/ k copy report.txt prn) to do the job but your tip would make it easy to move from one os to another. One question though, will NT print the file as a windows file (graphics) instead of the good ol' DOS text. Our files are just text but using windows, I found out that the text are still printed as "graphics" making printing slow. thanks again, Joben Hal Maner wrote: > > We used to print our reports by first outputting the report to a file, > > so the user can either view on screen, download, or print out. > > 1. to print, " lp -d printpc report.txt" > > You can do the same thing under NT. Only the command syntax will differ. > We ported several very similar pieces of code and here is what we did: > > 1. Store the operating system commands to be used in a table (nice to have > if you move from one op. sys. environment to another -like you are now- or > if you want the same app to use the same source code in multiple op. sys. > environments). > > 2. Then, in your program do something like: > > -- 06/22/1999 HMM: Use commands from loc_control. > LET runline = gr_loc.loc_lp_cmd CLIPPED,prname CLIPPED," ",flname CLIPPED > -- let runline = "lpr -P",prname clipped," ",flname clipped (this was > the old stuff - just like yours) > run runline > > gr_loc global record contains the following elements and values in it (in > our example): > loc_lp_cmd: PRINT /D: > > prname is the printer name that you want (have to use the full sharename of > the printer if it is not local), flname is the filename that you want to > print. > > In short, the corresponding NT command to your lp -d printpc report.txt > command is: > PRINT /D:\\\\computername\\printpc report.txt > > If printpc is a local printer on the computer running your program, then you > can omit the \\\\computername... > > You can test this command from within a 4GL program or in a DOS command > window in NT... > > > 2. to view "view report.txt" (view is a program we wrote in C) > > > > If your C program is ANSI C, you can recompile for DOS/Windows and continue > using it (in a DOS command window), or, better yet, instead of the PRINT /D: > command, you can use the name of your favorite editor, for example > NOTEPAD... > > > the question now is, what is the best way of doing this in an NT > > Environment. We're very new to an NT setting and we were told that all > > we need is to "recompile" and everything will work as is... yeah right. > > > > Everything "almost" works as is - there is some adjusting to do, as you have > found out. In case you are using the PRINT FILE statement, 2.10 has some > bugs under certain circumstances. See the Dynamic 4GL newsgroup > informix.idn.dynamic4gl. > > Hal Maner > M Systems International, Inc.
As far as I tried, I could not find any way to use Windows printing functionality for d4gl 2.x eports on Windows platforms. So I had to use DOS print command and had to set the paper-printer definitions on the printer itself. Also you have to be careful if you use d4gl 2.x since due to a bug, these versions think that they are printing out reports on Unix even though you use Windows OS. This results to ASCII reports with Unix EOL characters, meaning that all the report data is cast into one line on Windows platforms. So you may use an extra PRINT ASCII 13 (^M) statement when necessary. However this is not the perfect solution. It is better to upgrade to 3.x Good luck.. Alp In article <381522AC.6B5A1777@iname.com>, "Maria Araceli R. Rara" <arrara@treasury.gov.ph> wrote: > Thanks for the tip. We also dug around and thought of using the > d4gl > extension... > winexec(cmd/ k copy report.txt prn) to do the job but your tip > would make it > easy to move from one os to another. > One question though, will NT print the file as a windows file > (graphics) instead > of the good ol' DOS text. Our files are just text but using > windows, I found out > that the text are still printed as "graphics" making printing slow. > thanks again, > Joben * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free!