Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NetCobol 7.3.2: How to specify printer format for ReportWriter report 1

Status
Not open for further replies.

mavin16

Programmer
Apr 15, 2011
4
US
I am forced to use an older, unsupported version of NetCobol (7.3.2) for a straight conversion of numerous existing cobol programs from VMS to Linux environment. The Cobol programs use ReportWriter to create reports that are printed to various printers. The formatting of the reports (e.g., font, page orientation) is handled externally to the cobol program, i.e, the cobol program generates a simple ascii file and the VMS print command specifies a FORM that sends the appropriate PCL to the appropriate printer.

Using NetCobol as installed, the ReportWriter reports are being generated in Postscript which does not have the proper formatting and when sent to the printer with the PCL commands does not print correctly.

I am trying to find a specification for the Printer Information File (prtinf) in order to change the output format of reports generated with the ReportWriter feature. The reports need to be generated as simple ascii text files and use the existing PCL to be formatted.

I found the prtinf.eng file in /opt/FJSVcbl/COBOLRT/config/cob-defaults which set printer attribute to PS1 (see below). If I remove this value, the reports appear to be generated with PCL which I believe is specific to EPSON printers. I need to generate simple ascii text (I can handle the conversion of any end of line characters CR/LF) but I don't know what value to use to accomplish this. NOTE: I also looked into converting the Postscript to ASCII using ps2ascii but the ReportWriter generated postscript report has character spacing which results in a space between every character in the ASCII version.

The only reference I can find related to this subject is in the NetCOBOL PowerFORM Runtime Reference Manual (V10). Appendix C provides a definition of the Printer Information File but the keywords (e.g., PRTDRV) do not match the keywords found in the installed file (printer) and adding the keywords results in a runtime error.


# cat /opt/FJSVcbl/COBOLRT/config/cob-defaults/prtinf.eng
#---------------------------------------------------------------#
# Default print information file (ENGLISH) #
#---------------------------------------------------------------#
papersize ltr
printer PS1
 
I dont know anything about Netcobol, but PCL is a standard laser printer control which should work on any laser printer.
 
mrregan, thanks for the response.

I'm not a printer expert but I have learned that there are several different Printer Control Languages. PCL generally refers to the common HP PCL language for LaserJet printers. However, there are others such as EPSON sometimes referred to as ESC/P.

My problem is that there is a directive in the NetCobol prtinf file (printer PS1) which is controlling which format is output from using the ReportWriter feature of COBOL and I cannot find any documentation of what values are supported. Using PS1 generates PostScript. Remove the value generates EPSON ESC/P control codes. I want simple ASCII but could probably accommodate HP PCL if i could just find out how to configure this in NetCOBOL.
 
you might be able to keep the output as postscript and then use one of the postscripts to pcl converters. ghostscript for example.

Depending on your linux distro you may even have it already installed on your os, or it may be available as a package.

most of the times they are very easy to use, and you can use it as a pipe on your lp command or just run them on a ps file to convert to a pcl.

have a go at it. lots of info available on the net

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
fredericofonseca, good idea about converting from postscript. I did try this but the postscript file uses a strange font and character spacing and when i used the ghostscript ps2ascii program the ascii text has a space between every letter attempting to duplicate the spacing.

There appears to be NO formatting in the cobol program itself which uses Report Writer. A portion of the REPORT SECTION is shown below. So I'm looking for how to configure the printer information file. In addition to the value PS1 for Postscript printer, i have also found an example of the value UVPI which appears to generate EPSON specific PCL. I cannot find any other valid values for printer. And I cannot find how to change the font and/or spacing to generate simpler Postscript which could be converted.


REPORT SECTION.
RD PROJ-SUMMARY-REPORT
CONTROLS ARE FINAL, SL-TYPE, SL-DEPT
PAGE LIMIT 61
HEADING 1
FIRST DETAIL 9
LAST DETAIL 58
FOOTING 59.
01 TYPE PAGE HEADING.
03 LINE 1.
05 COLUMN 3 PIC X(5) VALUE "DATE:".
05 COLUMN 9 PIC Z9 SOURCE SYS-MM.
05 COLUMN 11 PIC X VALUE "/".
05 COLUMN 12 PIC 99 SOURCE SYS-DD.
05 COLUMN 14 PIC X VALUE "/".
05 COLUMN 15 PIC 99 SOURCE SYS-YY.
05 COLUMN 53 PIC X(29) VALUE
"COMPANY NAME HERE".
05 COLUMN 110 PIC XXXX VALUE "PAGE".
05 COLUMN 115 PIC Z(5) SOURCE PAGE-COUNTER.
03 LINE 3.
05 COLUMN 1 PIC X(33) VALUE
"PROJECT MANAGEMENT SUMMARY REPORT".
03 LINE 4.
05 COLUMN 1 PIC X(15) VALUE
"MONTH ENDING - ".
05 COLUMN 16 PIC X(11) SOURCE TH-DATE.
 
did you try ps2pcl?

and just to be sure are you using any keyword specific to powerFORM or just standard reportwriter ones?

and if not using powerFORM would that be a option to change programs?

Just looking at alternatives here. I don't have the 7.3 manual but have all other manuals from v3 to v8 + v10 ones and can't find, so far, any reference to those switches either.

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
I used SQR language (long time ago) to print forms, checks,micr etc using PCL and or postcript. PCL 6 should handle all lower version. You have to be familiar with the many PCL commands in order to accomplish this. Any laserjet/Epson printer is able to interpret PCL/Postcripts commands. You can use plain notepad to do this and I believe Cobol should be able to do it too (although I never tried it) as long as you can find a way to create a non-displayed set of characters which is interpreted by the printer as a command. I don't have my PCL manuals anymore but if you can tell me what PCL commands you need, maybe I can search my libraries for the codes.

here's a short example that I can remember
ENCODE '<27>&l2S' into $printf <<< Landscape mode, short edge
ENCODE '<27>&l1S' into $printf << Portrait, long edge
ENCODE '<27>&l0S' into $printf << Portrait, short edge
PRINT $printf (1,1) << encode in row 1, col 1

Where ENCODE creates the non-displayed commands,
PRINT embed the commands in the file.

On a typical print functions a combination of command are sometime necessary to initialize a printer. Here's one of it.

printer-init <27>E<27>&l0L<27>&l3A
| !--> Perforation Skip
--> Reset

On the print file itself you can see these hidden commands by using some kind of text editor like ultraedit.
 
Not sure if this will help, but in the CBR file do you have the @PrinterFontName setup? @PrinterFontName=(Courier New,Courier New) or something similar. Here is what I can find in the samples for NetCobol.

002540 FD PRINT-FILE.
002550 01 LINE-REC PIC X(136).
002560 01 CMNT-REC PIC X(050).
002570 01 CNTL-REC PIC X(100).

004840* DATA FOR I-CONTROL-RECORD
004850 01 I-CNTL-DATA.
004860 02 REC-ID PIC X(002) VALUE "I1".
004870 02 REC-MODE PIC X(001) VALUE "1".
004880 02 FOVL.
004890 03 FOVL-NAME PIC X(004) VALUE SPACE.
004900 03 FOVL-R PIC 9(003) VALUE 0.
004910 02 PAGE-COPY PIC 9(003) VALUE 0.
004920 02 FCB-NAME PIC X(004) VALUE SPACE.
004930 02 FORMAT-ID PIC X(008) VALUE SPACE.
004940 02 PIC X(030) VALUE SPACE.
004950 02 PAGE-FORM PIC X(002) VALUE SPACE.
004960 02 PAPER-SIZE PIC X(003) VALUE SPACE.
004970 02 PIC X(004) VALUE SPACE.
004980 02 PRINT-DUPLEX PIC X(001) VALUE SPACE.
004990 02 PRINT-POSITION PIC X(001) VALUE SPACE.
005000 02 NON-PRINT-AREA PIC X(001) VALUE SPACE.
005010 02 BIND-DIRECTION.
005020 03 PORT-FRONT PIC X(001) VALUE SPACE.
005030 03 PORT-BACK PIC X(001) VALUE SPACE.
005040 03 LAND-FRONT PIC X(001) VALUE SPACE.
005050 03 LAND-BACK PIC X(001) VALUE SPACE.
005060 02 BIND-WIDTH PIC X(004) VALUE SPACE.
005070 02 PRINT-OFFSET.
005080 03 FRONT-X PIC X(004) VALUE SPACE.
005090 03 FRONT-Y PIC X(004) VALUE SPACE.
005100 03 BACK-X PIC X(004) VALUE SPACE.
005110 03 BACK-Y PIC X(004) VALUE SPACE.
005120 02 DOCUMENT-NAME PIC X(004) VALUE SPACE.
005130 02 FILLER PIC X(005) VALUE SPACE.

005310* FOR 6LPI
005320*
005330* SET TO I-CONTROL-RECORD DATA
005340 MOVE "LT6L" TO FOVL-NAME.
005350 MOVE 1 TO FOVL-R.
005360 MOVE 1 TO PAGE-COPY.
005370 MOVE "LT6L" TO FCB-NAME.
005380 MOVE "L" TO PAGE-FORM.
005390 MOVE "LTR" TO PAPER-SIZE.
005400 MOVE "F" TO PRINT-DUPLEX.
005410 MOVE "F" TO PRINT-POSITION.
005420 MOVE "DOC1" TO DOCUMENT-NAME.
005430* WRITE I-CONTROL-RECORD
005440 WRITE CNTL-REC FROM I-CNTL-DATA
005450 AFTER ADVANCING PAGE-CNTL.

PAGE-CNTL IS IN SPECIAL-NAMES (CTL IS PAGE-CNTL)
 
Found a solution: Use ORGANIZATION LINE SEQUENTIAL in your FILE-CONTROL SELECT statements. This will remove the postscript characters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top