Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Receiving and Sending Data From Ports

40 views
Skip to first unread message

jonaid abbasi

unread,
May 3, 2013, 12:43:06 AM5/3/13
to
Hello

I am working under the unix environment and trying to receive data
from port and send back signals. I write the following code which is
not working properly. Can anybody help me and tell me whats wrong am I
doing.

ENVIRONMENT DIVISION.
special-names.
sysin is my123
sysout is my786.
INPUT-OUTPUT SECTION.
WORKING-STORAGE SECTION.
01 lokk pic x(01) value spaces.
01 my-choice pic 9(1) value zero.
01 ans PIC 9(01).
01 ans1 PIC 9(01).
01 opt pic 9(01) value 0.
01 dash-line PIC x(80) VALUE ALL "-".
PROCEDURE DIVISION.
start-001.
set environment "my123" to 8080'.
accept ans1 from my123.
move ans1 to ans.
set environment "my786" to 8080.
display ans upon my786.
goback.

Pete Dashwood

unread,
May 3, 2013, 7:33:02 AM5/3/13
to
Without any clues such as the platform (machine and COBOL version) it is
difficult to help. Port 8080 is often used as a substitute for port 80 but
there is a wide variety of software that can be running there (including a
Java server).

Your program is obviously incomplete and wouldn't even compile n many
platforms so you need to tell us what environment you are running in.

It looks "IBMish" and could even be SAP (ABAP?) but there is little point in
speculating. Tell us the platform.

In the meantime, try disabling your firewall while you test it.

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


Richard

unread,
May 3, 2013, 3:16:43 PM5/3/13
to
SYSIN and SYSOUT are files, the special-names merely map these
function names to mneumonic names. The files may be console or other
files, but are _NOT_ ports.

Your attempt to use environment variables to set where sysin and
sysout would, if it was done correctly, result in the file(s) named
"8080" being used.

Does the program even compile ?


Patrick

unread,
May 3, 2013, 4:59:38 PM5/3/13
to
Hi Jonaid

I am moving very slowly but I have a plan in place to create bindings for serial, ethernet and GPIB ports under Cobol.

Please have a look at open Cobol, it compiles to intermediate C and is fairly easy to link with C code. You might want to look at termios.

I should be able to help you in a month or two, wish I could be more help now-Patrick

jonaid abbasi

unread,
May 8, 2013, 5:46:13 AM5/8/13
to
On May 3, 4:33 pm, "Pete Dashwood"
> "I used to write COBOL...now I can do anything."- Hide quoted text -
>
> - Show quoted text -

Hello Pete

I am using acucobol under Unix SCO OpenServer Release Five and running
this program from workstation connected to server by telnet. The
program successfully compiled and run but receiving data from port it
rather accept from keyboard and display on screen.

jonaid abbasi

unread,
May 8, 2013, 5:48:51 AM5/8/13
to
> Does the program even compile ?- Hide quoted text -
>
> - Show quoted text -

Yes program compiled successfuly and even run with no problem. But it
receive variable from keyboard and display on screen rather port. Any
idea how can I engage ports for receiving and sending data. I am using
acucobol under unix environemnt SCO open server release 5.

Richard

unread,
May 8, 2013, 3:01:56 PM5/8/13
to
Yes, SYSIN and SYSOUT would map to console by default. I don't know
what AcuCOBOL does to change where these go, but I doubt that they
would go to a port - ports aren't like that.

> Any
> idea how can I engage ports for receiving and sending data. I am using
> acucobol under unix environemnt SCO open server release 5.

That OS is nearly 20 years old and hasn't had an update for 10 years.
AcuCOBOL went bust many years ago and was bought by Microfocus.

I doubt that you will get COBOL to do socket programming and would
suggest that you start doing it with Python which has a sockets
module. You can get Python 1.5 for Open Server 5 in the Skunkworks
here: ftp://ftp2.sco.com/pub/skunkware/osr5/vols/ Unfortunately
sockets requires 2.4 so get a Linux box. A tutorial is here:
http://www.ibm.com/developerworks/linux/tutorials/l-pysocks/

But what are you _actually_ trying to do ? Write a web server in
COBOL ?








0 new messages