For Programmers: Free Programming Magazines  


Home > Archive > Cobol > August 2007 > How to send a Fax from Powercobol application ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to send a Fax from Powercobol application ?
Massimo

2007-08-21, 7:55 am

Hi,
how can I send a Fax from an application written in Powercobol ?
Regards,
Massimo.


HeyBub

2007-08-21, 6:55 pm

Massimo wrote:
> Hi,
> how can I send a Fax from an application written in Powercobol ?
> Regards,
> Massimo.


Print to a fax printer?


Pete Dashwood

2007-08-22, 3:55 am



"Massimo" <blue_max_53@hotmail.com> wrote in message
news:%Kyyi.92219$%k.235504@twister2.libero.it...
> Hi,
> how can I send a Fax from an application written in Powercobol ?
> Regards,
> Massimo.
>

Here is a workable solution that uses the COM component already in the XP
Operating System.

This is an optional install for XP, so you must go to Control Panel and
install the fax service first. (if it hasn't been already)

Select Add/Remove programs> Add or Remove Windows components.
Tick the box for Fax Service.

You can then configure the service from the printers and faxes dialogue. (Or
you can do it programmatically using the component described below.)

Having got a fax service running on the system, you now want to use it from
PowerCOBOL.

Here's an event procedure that allows you to set up and send a Fax with
standard cover page (which you can preconfigure or do dynamically under
program control.) You must set the repository to support COM, as I
described earlier.

>

ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 progID pic x(25) value "FaxServer.FaxServer.1".
01 objFAX OBJECT REFERENCE COM.
01 objFAXDoc OBJECT REFERENCE COM.
01 CPNote pic x(8) value "Hello...".
01 ServerName pic x(9) value "\\PetesP4". *> use the name
*> of the computer to which your fax modem
*> is attached.
01 DocToSend pic x(13) value "SampleDoc.Doc".
01 FaxNumber pic x(10) value "1234567890".
01 Truth pic s9(5) comp-5 value POW-TRUE.

PROCEDURE DIVISION.
invoke COM "CREATE-OBJECT"
using progID
returning objFAX
end-invoke

invoke objFax "Connect"
using ServerName
end-invoke

invoke objFax "CreateDocument"
using DocToSend
returning objFAXDoc
end-invoke

invoke objFAXDoc "SET-CoverpageNote"
using CPNote
end-invoke
invoke objFAXDoc "SET-FaxNumber"
using FaxNumber
end-invoke
invoke objFAXDoc "SET-SendCoverpage"
using Truth
end-invoke

invoke objFAXDoc "Send" *> sends the document
end-invoke

invoke objFax "Disconnect"
using ServerName
end-invoke

set objFAX to null
set objFAXDoc to null

As you can see this is not too hard. It uses late binding so all parameters
must be By Reference.

There are many thousands of functions included with XP; it is worth taking a
look through them. Remember that COM components can be brokered through
CORBA now, so they can be accessed remotely from Linux systems also.

HTH,

Pete
--
"I used to write COBOL...now I can do anything."


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com