From: razor on
Hello chaps

I am currently working on a program that creates a number of customers
orders within a 'print file'. A separate file is created per depot/
store. Typically this would contain 200+ orders. They are ordered by
the delivery sequence number. On change of 'route no', the program
throws a new page (WRITE AFTER PAGE).

Now I already have a program that converts a print file to HTML and
emails to a location. We do this simply by inserting the contents into
a very simple HTML file as preformatted text.

My problem is that the store wishes to print the file out and give
each page(s) to each delivery route driver. I need to replace the FF
(x"0C") characters with some other way of throwing a page in HTML, but
within the PRE tag. Or maybe I need to close the PRE tag, throw a page
and reopen. I've tried a few things all to no avail. Not exactly a
COBOL question, but its all about 'HTML for people who mainly only
know COBOL'.

Many thanks for any help with this.

Razor
From: Richard on
On Dec 31, 2:27 pm, razor <irudd...(a)blueyonder.co.uk> wrote:
> Hello chaps
>
> I am currently working on a program that creates a number of customers
> orders within a 'print file'. A separate file is created per depot/
> store. Typically this would contain 200+ orders. They are ordered by
> the delivery sequence number. On change of 'route no', the program
> throws a new page (WRITE AFTER PAGE).
>
> Now I already have a program that converts a print file to HTML and
> emails to a location. We do this simply by inserting the contents into
> a very simple HTML file as preformatted text.

What is the point of 'converting it to HTML' if what you do is to
email it?

I could see the point of making it HTML if it were to be accessed from
a web site by the client using a browser, but email does not need HTML
at all.

If you emailed it as a text attachment then it could be opened in,
say, notepad or any text editor and printed from there _with_ page
throws.


> My problem is that the store wishes to print the file out and give
> each page(s) to each delivery route driver. I need to replace the FF
> (x"0C") characters with some other way of throwing a page in HTML, but
> within the PRE tag. Or maybe I need to close the PRE tag, throw a page
> and reopen. I've tried a few things all to no avail. Not exactly a
> COBOL question, but its all about 'HTML for people who mainly only
> know COBOL'.

HTML is a _display_ format and not a print format. HTML will normally
ignore any control characters such as CR, LF, and FF, or even multiple
spaces and tabs, as these are irrelevant to the markup tags.

The answer is going to be: Don't use HTML

If I were to do this I would send each print file as a text attachment
to the email (or each as a separate email) with FF embedded and with a
mime type that was linked in the client to a print program (eg lpr on
Unix/Linux).

Then clicking on the attachment will cause it to print (including form
feeds).



From: razor on
Hello Richard

Excellent points.

'I' don't want to send it via HTML. I was told in the past. Yes we
tried sending text, but the users found it too complicated (I was
told). I have a single 'engine' that takes a print file and emails it
as a HTML file as an attachment. When they open it it opens in a
browser. I don't want to go into this and change it to email either a
text file or a HTML file depending on.....

Don't know what 'mime types' are. Even if it is correct, nobody is
going to pay for my time to find out. Almost embarrassing posting this
as the reason however its 3 in the morning and I haven't emailed the
orders yet that came in at 5pm and need to be at the depot when they
open at about 4pm.

Anyway, I've just had one of those moments where you don't give up and
eventually find what you need to do, thanks to the 'net. My HTML file
went;

<pre>
text line 1
text line 2
text line n
</pre>

Crude, but it worked.

I now have;

<div style="page-break-after: always;"&nbsp</div>

<pre>
text line 1
text line 2
text line 3
</pre>

<div style="page-break-after: always;"&nbsp</div>

<pre>
text line 4
text line 5
text line 6
</pre>

And it works and passes W3 org tests.

Thanks anyway

Razor
From: Richard on
On Dec 31, 3:52 pm, razor <irudd...(a)blueyonder.co.uk> wrote:
> Hello Richard
>
> Excellent points.
>
> 'I' don't want to send it via HTML. I was told in the past. Yes we
> tried sending text, but the users found it too complicated (I was
> told). I have a single 'engine' that takes a print file and emails it
> as a HTML file as an attachment. When they open it it opens in a
> browser. I don't want to go into this and change it to email either a
> text file or a HTML file depending on.....
>
> Don't know what 'mime types' are. Even if it is correct, nobody is
> going to pay for my time to find out. Almost embarrassing posting this
> as the reason however its 3 in the morning and I haven't emailed the
> orders yet that came in at 5pm and need to be at the depot when they
> open at about 4pm.

Is that supposed to be 4am ?

Are you emailing these manually ? Good grief, building an email with
attachment and having it sent automatically via a job step or cron job
is^H^H should be easy.

Here is a template for an email with attachment. Note that the tags
are marked with %name% for substitution.

%atype% is the attachment's mime type which could be text/plain or
text/html or even application/something. %name% can also control what
happens to the attachment, so eg name.csv would be opened in
OpenOffice.org or Excell or ...

Note that the boundary mark can be any random squiggle of characters
that you choose. You can add any number of attachments but I usually
have the program send one email per file.


From: %from%
To: %to%
Subject: %subject%
Date: %date%
MIME-Version: 1.0
Content-Type: Multipart/Mixed;
boundary="Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD"
MIME-Version: 1.0

--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

%message%

--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD
Content-Type: %atype%;
name="%name%"
Content-Disposition: attachment; filename="%name%"
Content-Transfer-Encoding: %encoding%

%attach%
--Boundary-=_nWlrBbmQBhCDarzOwKkYHIDdqSCD


>
> Anyway, I've just had one of those moments where you don't give up and
> eventually find what you need to do, thanks to the 'net. My HTML file
> went;
>
> <pre>
> text line 1
> text line 2
> text line n
> </pre>
>
> Crude, but it worked.
>
> I now have;
>
> <div style="page-break-after: always;"&nbsp</div>
>
> <pre>
> text line 1
> text line 2
> text line 3
> </pre>
>
> <div style="page-break-after: always;"&nbsp</div>
>
> <pre>
> text line 4
> text line 5
> text line 6
> </pre>
>
> And it works and passes W3 org tests.
>
> Thanks anyway
>
> Razor

From: singa on
Hy Guys,
i am experiencing with cobol (RmCobol85) since 1984,
all of my reports (from *nix servers) are going to
users or external customers (b.e. invoices) sending
text output from Cobol to email thru a simple PDF
wrapper

In other word the output of cobol ASSING TO PRINT
goes to a pipe, here i have the PDF wrapper, PDF
output file goes to email

At the top of the print output, for each page, i put
the destination email address , if omitted is the
currently logged in user

For each Form Feed the wrapper close the current PDF
and will open the next one.

The PDF wrapper could be a simple PHP script, or some
similar (i am not confident with Php, so i have a C program,
built with lex and Clib)

In this way the attachment is a pure PDF file, with
all the advantages (archiving, printing. virus scan,
portability, ...)

Plus: using PDF is possible to draw box, circle, barcodes, ....

If someone is interested i can send them some samples
of output and more details

Sorry but my English is very bad, and all my software and
manualals are in Italian

 |  Next  |  Last
Pages: 1 2 3 4 5
Prev: contract jobs in australia
Next: Visual Object Cobol