Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, I released a small cobol library on SourceForge to help generating PostScript files from Cobol programs. It is written in Object Cobol with the MF OCDS. It has been tested with success under Linux with OCDS and Windows with NetExpress. If you find it usefull, use it! It is under a GPL license. If you want to join for the development, you are welcome ! This is a first release. It is not complete but it has been put in production environment. So, it is working. Of course, there is still a lot of work to do to make it as opened as possible (not tested with Fujitsu for example) and to complete it (especially a performant text manipulation, the documentation, etc.). It can be useful for the generation of graphics, reports that can be sent to a postscript printer of visualized on the screen with a program like GSView. The address : http://pscoblib.sourceforge.net Regards. Alain Reymond
Post Follow-up to this message> I released a small cobol library on SourceForge to help generating > PostScript files from Cobol programs. Just last wI did some work on creating postscript from Cobol. Previously I had been doing it with a 2 stage process outputting a text file of substitution values and then doing a merge of these against a postscript file created using a drawing program - impress (not the OOo program of that name). The merge had been written in C. Having used libps from Python with a templating mechanism I decided that it would be useful to do in Cobol. Many of the libps routines can be called, but Fujitsu Cobol for Linux does not allow a floating BY VALUE to be used in the CALL. I had to write simple C routines to take a fixed parameter, convert to float and then call libps. The postscript is only used from templating routines and the template does all the driving. For example a template may be: # comments start # in column 1 *PS *LEFT=8 *TOP=1 # ----------------------------------------------------- :header *START=0 *USE=11 #box,line,col,len,width,shade=style #text,line,col,font,b|u|i=text #line,line,col,width=style box,2,1,58,65,1.0=white text,1,1,13=SOME CUSTOMER LTD. text,1,52,10=Procedure No. 3.4 f1-0 line,1.2,1,65=solid box,2,1,3,65,0.9=gray text,4,3,14,b=CORRECTIVE ACTION REQUEST text,4,34,12=(including preventive action) text,4,56,12,b=No.<!%carno%> text,7,3,12=1. Issued to: <!%istoname%> text,7,30,12=by: <!%issuname%> text,7,50,12=on: <!%dated.date%> text,9,3,12=as a result of: <!%codename%> <!%other%> line,10,1,65=solid # ---------------------------------------------------------- :standard *START=+ *USE=5 text,1,3,12=2. Applicable standards and documents: <!%standard%> line,2.5,1,65=solid text,4,3,12=3. Description of non-conformance or potential non-conformance or improvement: # ---------------------------------------------------------- :reqline *START=+ *USE=1 text,1,3,12,b=<!%request.line%> # ------------------------------------- :signon *START=+ *USE=3 text,2,3,10=Signature of initiator: <!%issuname%> text,2,36,10=Date: <!%dated.date%> line,2.5,1,65=solid # ----------------------------------------------------- :response *START=+ *USE=2 text,1,3,12=4. Corrective Action / Preventive Action # ------------------------------------ :respline *START=+ *USE=1 text,1,3,12,b=<!%response.line%> # ------------------------------------ :respend *START=+ *USE=5 text,2,3,10=To be implenented By: <!%donename%> text,2,36,10=By Date: <!%completed.date%> text,4,3,10=Proposed By: <!%issuname%> text,4,36,10=Date: <!%dated.date%> line,4.5,1,65=solid # ---------------------------------------------------------- :trailer *START=+ *USE=2 text,1,3,12=5. Follow-up: <!%satisfy%> <!%newcar%> # ------------------------------------ :trailine *START=+ *USE=1 text,1,3,12,b=<!%closing.line%> # ------------------------------------ :traiend *START=+ *USE=3 text,2,3,10=Signature: <!%closname%> text,2,36,10=Date: <!%closed.date%> line,2.5,1,65=solid image,3,3,jpeg,1=linfox.jpg # ----------------------------------------------------------- :end The program sets up a table of tag + value pairs and then calls the template routine specifying the section to output. Sections start with :. The template program processes each line in the section replacing the tags <!%name%> with the value from the table that matches to tag 'name'. It then passes each line to the postscript processor which identifies the object required (box, text, line) and calls libps as required. All offsets are line, column (but may be decimal (ie 2.5) with 0,0 as top left of page (ie inverted from PS). The *START and *USE commands update the current line offset for each section so that the page builds down from the top. line and column are relative to offsets which start at the *TOP and *LEFT commands. The 'text' specifies font size and style (eg b=bold). 'box' specifies a fill gray level. The advantage (IMHO) of this approach is that the program itself only cares about the data items and the sections, the template file does all the presentation. The *PS at the top tells the template program that this uses the PS routines, it can also output HTML, CSV, or text for printing. This means that the program need not care what is being output, it only needs to allow the template file to be selected by some means and then bang out the sections. The PS processing code is OO in Fujitsu Cobol for Linux.
Post Follow-up to this messageRichard a écrit : > > The PS processing code is OO in Fujitsu Cobol for Linux. You can probably mix the two approaches in the program that calls the ps methods. It should be possible to port the pscoblib library under Fujitsu. If you want to join... Regards.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.