Operating System - OpenVMS
1752307 Members
5252 Online
108786 Solutions
New Discussion юеВ

Re: Coding a Service in DCL

 
SOLVED
Go to solution
Jack Trachtman
Super Advisor

Coding a Service in DCL

I need to create a network Service that accepts a single line and returns one or a few lines.

I've been searching high & low through the VMS forums, tried using Google, scanned the manuals, and checked out dcl.openvms.org, but can't seem to find any examples.

I like to write it in DCL, but am open to other scripting languages.

Can anyone point me to some examples? TIA
7 REPLIES 7
RBrown_1
Trusted Contributor

Re: Coding a Service in DCL

Perhaps something in the old DECnet phase IV manuals?

This works on phase IV:

On your remote node, create command file SENDTIME.COM

$ OPEN/READ/WRITE NET SYS$NET
$ READ NET NOTHING
$ WRITE NET F$TIME ()
$ CLOSE NET
$ EXIT 1

Then, on the remote node:

$ MCR NCP SET OBJECT SENDTIME NUMBER 0 FILE

Now, on the local node, type:

$ OPEN/READ/WRITE NET ::"TASK=SENDTIME"
$ WRITE NET " "
$ READ NET RTIME
$ CLOSE NET
$ WRITE SYS$OUTPUT "Time on remote system is ", RTIME

Steven Schweda
Honored Contributor

Re: Coding a Service in DCL

Define "network Service".

What kind of network? DECnet? IP?
Jack Trachtman
Super Advisor

Re: Coding a Service in DCL

Sorry - forgot about DECnet services.

My project must be a TCPIP service.
Hoff
Honored Contributor

Re: Coding a Service in DCL

DCL doesn't have particularly good hooks into IP networking; hooks and interfaces that are analogous to what can be done with DECnet or with other scripting languages.

Though you can sometimes hack something together:

http://wwwvms.mpp.mpg.de/pub/VMSSIG/SRC/COM/IDENTD.COM

You can code stuff as a DCL CGI, and go that way. DCL can read CGI forms and such.

http://labs.hoffmanlabs.com/node/277

(I had a chapter on this topic in the DCL book, but re-reading the generated HTML makes me want to rework the DCL shown in that chapter.)

The usual approach here is php or perl or python or lua or such; something with a CGI library and the ability to encode and decode URLs. (Yes, much of this can be done in DCL.) Most scripting languages have an IP socket library. (DCL is an exception here.) Here's a discussion of one for Lua:

http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/old/luasocket-1.0/

Examples? Google. Or look in TCPIP$EXAMPLES: or such for C code and pieces. Or look around at most any perl or php or python or lua book, or any of the plentitude of language-associated web sites around.

And yes, perl, php, python and lua and other languages are all available for OpenVMS.


Aaron Sakovich
Super Advisor

Re: Coding a Service in DCL

I once implemented a simple identd service, sort of as a honeypot, when I found my systems were getting regularly probed.

I don't recall exactly how I set up the service, although that should be fairly straightforward.

I've attached the .com file (as a .txt file) that actually implements the service. You can see how it gets info on the inbound request, sends information back, and logs the request.

HTH
Aaron Sakovich
Super Advisor
Solution

Re: Coding a Service in DCL

Nuts, I posted a bum version of the file. Here's the correct one. There are several errors in the previous one (e.g., nonexistent error handler, etc.)

Jack Trachtman
Super Advisor

Re: Coding a Service in DCL

Hoff: thanks for the leads. Will investigate.

Aaron: thanks for the script. This was exactly what I needed to get started.