If anybody knows how to write-to and read-from a serial port
from acucobol, y really neads your help.
I want to write to Fiscal Printer and read its answer and
status. All this throu the serial ports.
Thanks. [sig][/sig]
USE OTHER LANGUAGE - COBOL IS WELL-KNOWN FOR ITS USEFULNES
IN THE MANAGEMENT OF PORTS COMx.
ANYWAY, I THINK, THERE'S A DRIVER FOR FISCAL PRINTER RUNNING UNDER MS-DOS.
YOU CAN CONTACT INFOCOM S.A. IN ARGENTINA.
NAVIGATE
I agree with Carlin. Cobol is not well suited for COM port work. There is, however, a way around it, but this is theoretical. Lemme know if this helps. This will only let you write to the port, though...
Assuming you're working under Windows, add a text only printer to Windows, and configure it so that it prints to COMx. Configure all communication settings (i.e. port speed, parity, etc) under the printer properties. Call this printer COM-PRINTER (for example).
In cobol, define a file as:
SELECT MY-PRINTER ASSIGN TO PRINTER "COM-PRINTER"
ORGANIZATION IS SEQUENTIAL.
Define a regular FD section for it, and then just open output, write, and close. Other OPEN modes would most probably not work (although maybe EXTEND will; don't know).
Finally, here's what the help file (v5.1.4) has to say about PRINTER files:
PRINT, PRINTER, PRINTER-1 - A sequential file marked with one of these device phrases will be treated as a "print" file. Print files may not be opened for INPUT or I/O. When records are written to a print file, trailing spaces are first removed from the record. Print files have printer carriage control information added to them as specified by the WRITE statements that add records to the file. If "PRINTER" or "PRINTER-1" is specified, and no file-spec is specified, then the external file name is treated as "PRINTER" or "PRINTER-1" (unless RM/COBOL compatibility mode is being used, in which case rule 6 applies instead). Normally, these names are translated at runtime to the name of the system spooler. This is an exception to rule 6 above.
The next best thing to this is to use a COM port OCX control (which I'm sure you can get from tons of places on the net) and incoporate it into ACU. OCX object are rpetty well supported and are actually fun to work with.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.