|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
Gerry,
Attached is the dtwsplfb Net.Data macro that we use to do the conversion.
Specifically look at the section starting with "%function(dtw_sql) tblget()
{". This function reads a file on the 400 created with the cpyspl CL
program I also attached. The .rtf file header info is gotten from templates
that we created, different ones for different record lengths. These
templates were created by creating a document in Word and saving as a .rtf
file and then opening that file with a text editor and deleting everything
from the point the actual text in the document starts thus just leaving the
.rtf header info. I also attached our template files. If there is anything
you don't understand just let me know and I will be glad to help out.
Scott Mildenberger
> -----Original Message-----
> From: Tucker Gerry [mailto:Gerry.Tucker@technicolor.com]
> Sent: Thursday, February 14, 2002 7:40 AM
> To: rpg400-l@midrange.com
> Subject: RE: Rich-Text-Format
>
>
> Anything would help thanks.
>
> Regards,
>
> Gerry Tucker
> Senior Analyst Programmer
> Technicolor Distribution Services
> Wembley, U.K.
>
>
> -----Original Message-----
> From: Scott Mildenberger [mailto:Smildenber@Washcorp.com]
> Sent: 14 February 2002 14:36
> To: 'rpg400-l@midrange.com'
> Subject: RE: Rich-Text-Format
>
>
> I have a Net.Data macro that does it if you would like.
>
> Scott Mildenberger
>
> > -----Original Message-----
> > From: Tucker Gerry [mailto:Gerry.Tucker@technicolor.com]
> > Sent: Thursday, February 14, 2002 7:05 AM
> > To: rpg400-l@midrange.com
> > Subject: Rich-Text-Format
> >
> >
> > Has anyone got or knows of a FREE utility (including
> source) that will
> > convert a spooled-file to Microsoft Rich Text Format? I've
> written a
> > command to convert spooled-files to plain-text, HTML or PDF
> files but
> > I'd like to be able to add an RTF option to it.
> >
> > Regards,
> >
> > Gerry Tucker
> > Senior Analyst Programmer
> > Technicolor Distribution Services
> > Wembley, U.K.
> > _______________________________________________
> > This is the RPG programming on the AS400 / iSeries (RPG400-L)
> > mailing list
> > To post a message email: RPG400-L@midrange.com
> > To subscribe, unsubscribe, or change list options,
> > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> > or email: RPG400-L-request@midrange.com
> > Before posting, please take a moment to review the archives
> > at http://archive.midrange.com/rpg400-l.
> >
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
> list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list
> To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
--
pgm parm(&splf &job &usr &nbr &spln &how)
dcl var(&splf) type(*char) len(10)
dcl var(&job) type(*char) len(10)
dcl var(&usr) type(*char) len(10)
dcl var(&nbr) type(*char) len(6)
dcl var(&spln) type(*dec) len(15 5)
dcl var(&how) type(*char) len(8)
CRTPF FILE(QTEMP/RTFTEMP) RCDLEN(200) SIZE(*NOMAX)
monmsg cpf7302
CPYSPLF FILE(&splf) TOFILE(QTEMP/RTFTEMP) +
JOB(&NBR/&USR/&JOB) SPLNBR(&SPLN) +
TOMBR(*FIRST) MBROPT(&HOW) CTLCHAR(*FCFC)
endpgm
--
%define {
LIB = "QTEMP"
RTFFILE = "RTFTEMP"
rtfhdr080 = "/home/webspool/rtfhdr080.rtf"
rtfhdr132 = "/home/webspool/rtfhdr132.rtf"
rtfhdr198 = "/home/webspool/rtfhdr198.rtf"
hdr = %TABLE
Table1 = %TABLE
DTW_PRINT_HEADER = "NO"
DTW_DEFAULT_REPORT = "NO"
DTW_REMOVE_WS = "YES"
CrLf = {@DTW_rHEXTOCHAR("0D25")%}
FirstPage = "1"
%}
%{ Copy spool file to QTEMP/RTFTEMP %}
%function (dtw_directcall) cpysplf(In char(10) p1,
In char(10) p2,
In char(10) p3,
In char(6) p4,
In dec(15, 5) p5,
In char(8) p6) {
%exec{CPYSPL.PGM %}
%}
@cpysplf($(SPLF),$(JOB),$(USR),$(NBR),$(SPLN),"*REPLACE")
%macro_function prthdr(inout table) {
%report {%row{$(V1)%}%}
%}
%function(dtw_sql) tblget() {
SELECT * from $(LIB).$(RTFFILE)
%report {
%if ($(WIDTH) == "80")
@dtw_assign(rcdlen,"80")
%elif ($(WIDTH) == "198")
@dtw_assign(rcdlen,"198")
%else
@dtw_assign(rcdlen,"132")
%endif
@dtw_tb_setcols(Table1,"1") @dtw_assign(Row1,"0")
%row {
@dtw_substr(V1,"1","1"," ",PrtCtl)
@dtw_substr(V1,"2",rcdlen," ",PrtData)
%if (PrtCtl == "1")
%if (FirstPage == "1") @dtw_assign(FirstPage,"0")
%else @dtw_assign(CtlData,"\par \page ") %endif
%elif (PrtCtl == "+")
@dtw_assign(y,"0")
%while (y < rcdlen) { @dtw_add(y,"1",y)
@dtw_substr(PrtData,y,"1"," ",Chr)
@dtw_substr(SavData,y,"1"," ",Sav)
%if (Chr == " " && Sav != " ")
@dtw_delstr(PrtData,y,"1",PrtData)
@dtw_insert(Sav,PrtData,@dtw_rsubtract(y,"1"),"1",PrtData)
%endif
%}
%elif (PrtCtl == " ")
@dtw_assign(CtlData,"\par ")
%elif (PrtCtl == "0")
@dtw_assign(CtlData,"\par \par ")
%elif (PrtCtl == "-")
@dtw_assign(CtlData,"\par \par \par ")
%endif
%if (CtlData != " ") @dtw_concat(CtlData,PrtData,PrtLine)
%else @dtw_assign(PrtLine,PrtData) %endif
@dtw_assign(SavData,PrtData)
%if (PrtCtl != "+")
@dtw_tb_appendrow(Table1,"1") @dtw_add(Row1,"1",Row1)
%endif
@dtw_tb_setv(Table1,PrtLine,Row1,"1")
%}
@dtw_tb_appendrow(Table1,"1") @dtw_add(Row1,"1",Row1)
@dtw_tb_setv(Table1,"\par }}",Row1,"1")
%}
%}
%macro_function tblprt(INOUT table) {
%report {%row{$(V1)%}%}
%}
%if ($(WIDTH) == "80")
@dtwf_read(rtfhdr080, "ASCIITEXT", " ", hdr)
%elif ($(WIDTH) == "198")
@dtwf_read(rtfhdr198, "ASCIITEXT", " ", hdr)
%else
@dtwf_read(rtfhdr132, "ASCIITEXT", " ", hdr)
%endif
%html(macro2.rtf) {
Content-type: application/rtf$(CrLf)
Expires: Fri, 30 Oct 1998 12:00:00 GMT$(CrLf)
Content-encoding: ebcdic$(CrLf)$(CrLf) @prthdr(hdr)
@tblget() @tblprt(Table1)
\par }}
%}
--
[ rtfhdr080.rtf of type application/rtf deleted ]
--
[ rtfhdr132.rtf of type application/rtf deleted ]
--
[ rtfhdr198.rtf of type application/rtf deleted ]
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.