Re: How to make IBM COBOL send in text in Telnet mode?
- From: mwojcik@xxxxxxxxxxx (Michael Wojcik)
- Date: 1 May 2005 14:46:41 GMT
In article <1114789034.177346.280990@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, dave@xxxxxxxxxxxxx writes:
>
Please don't top-post. Intersperse new text in your reply with concise
quoted material relevant to it:
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
-- David Bonde
[I've also reformatted wrapped lines in the following quoted material.]
> Our method does rely on a IIS extension, so IIS is really acting as a
> Telnet client. What I need is for AIX to act as a Telnet server, and
> I need a COBOL program to send/receive to/from the Telnet server.
AIX has a Telnet server, like every Unix implementation for the past
20 years or so. AIX itself does not "act as a Telnet server" -
either something is a Telnet server or it isn't, and with AIX as with
most OSes it's implemented separately from the kernel. I want to be
precise here because with distributed applications it's vital to have
an accurate understanding of how they work.
In the case of AIX (at least with 4.2; I haven't bothered checking a
more recent version), the telnet server is /usr/sbin/telnetd, and it's
usually run under the auspices of inetd. This is typical for Unix
systems.
Running a COBOL program under a Telnet server is easy. Normally you'd
just log in through Telnet and then execute it under your login shell.
That's the whole point of Telnet, after all.
If you want to cut out the middleman - the shell - then just do so.
telnetd runs /usr/sbin/login, which requests a username and (optionally)
a password and then runs whatever's listed as the initial program for
that username in /etc/passwd. Normally that's a shell, but it could
be your COBOL program. (Note that you need superuser permission to
assign a program not listed in /etc/shells as the initial program for
an account.)
For example, you create an entry in /etc/passwd that looks like this:
myapp::500:100:COBOL application:/home/myapp:/path/to/myapp
(adjusting all of those fields as appropriate for your installation)
and have your Telnet client log in as "myapp". (In this case, no
password is required, because the second field above is empty.)
login will run /path/to/myapp automatically, and its console I/O will
be through the pty which is attached to the Telnet connection, just
as if it were a shell.
That would still require that your Telnet client - the IIS extension -
pass a username to login when prompted for it. If it's not capable of
doing that, I think you'll have to find another Telnet server (there
are open-source ones available), as I don't believe AIX telnetd has an
option to invoke anything other than /usr/sbin/login once Telnet nego-
tiation has finished.
The best references for implementing Telnet in Unix are W. Richard
Stevens' classic _Advanced Programming in the UNIX Environment_ and
_UNIX Network Programming_, but you shouldn't need that level of detail.
A book on Unix system administration should explain the relationships
among telnetd, login, and the shell or other initial program in more
detail if this is unclear.
> I will look at the pseudo-tty interface.
Unless you're writing your own Telnet server you don't need to.
Now, things will be trickier on the AS/400, because OS/400 and
applications written for it are designed to be used with block-mode
5250 terminals, and with the TN5250 Telnet variant which emulates
them. OS/400 does have support for "classic" Telnet for terminal
types that it recognizes such as VT100 (they have to provide adequate
support for things like cursor positioning so that it can emulate
full-screen mode by drawing each screenful of data). Since COBOL
applications on OS/400 typically want to do block-mode screen-by-
screen displays, it may be difficult to get streaming console I/O
from a COBOL program. The various OS/400 C implementations have a
special stream-I/O mode, to support the vast code base of C programs
that expect to do console I/O that way, but I'm not sure it's
available to COBOL programs.
Out of curiousity I just tried a little COBOL program on OS/400 that
did a couple of displays, and it displayed a screen with a "job
started" line and the first line of output; I had to hit Enter to get
the next line, and it looked like it was positioning the cursor for
it. Not simply streaming console output, in other words.
I'd suggest taking up the AS/400 issues on comp.sys.ibm.as400.misc.
If there's a FAQ for that group, it may already be addressed there.
Personally, a Telnet connection would not be my choice for this
application anyway. Telnet is not designed for tunnelling applica-
tion to application data. (The RFCs mention that possibility, and
NVT is used for some connections that are typically app-to-app like
FTP and SMTP, but it was a secondary consideration.) There's a
reason why HTTP was invented: to transmit HTML and related data. It'd
be much cleaner to just run your COBOL applications as CGI programs
under an HTTP server.
--
Michael Wojcik michael.wojcik@xxxxxxxxxxxxxx
I will shoue the world one of the grate Wonders of the world in 15
months if Now man mourders me in Dors or out Dors
-- "Lord" Timothy Dexter, _A Pickle for the Knowing Ones_
.
- Follow-Ups:
- Re: How to make IBM COBOL send in text in Telnet mode?
- From: Richard
- OT - Top-Posting (was: How to make IBM COBOL send in text in Telnet mode?
- From: William M. Klein
- Re: How to make IBM COBOL send in text in Telnet mode?
- Prev by Date: Re: Evolution or Creation of Programming Language Names (Was: OT - "lie" vs "error")
- Next by Date: Re: IBM Help
- Previous by thread: Re: Performance problem with a VSAM files
- Next by thread: OT - Top-Posting (was: How to make IBM COBOL send in text in Telnet mode?
- Index(es):
Relevant Pages
|