Operating System - OpenVMS
1827791 Members
2618 Online
109969 Solutions
New Discussion

Re: KSH to DCL command question - easy.

 
Allan Parsons
Advisor

KSH to DCL command question - easy.

Quick question -

What is the VMS equivalent of *NIX's awk and sed commands?

Also, is there a good, recommended, resource for DCL programming on the internet that someone could point me to?
13 REPLIES 13
Ian Miller.
Honored Contributor

Re: KSH to DCL command question - easy.

gawk is available for VMS.
equivlient of sed - SUMSLP I guess
http://h71000.www7.hp.com/doc/73final/documentation/pdf/OVMS_SUMSLP_UTIL.pdf

Lots of dcl examples can be found at
http://dcl.openvms.org

See dcl entries on
http://www.openvms.org/pages.php?page=Resources
____________________
Purely Personal Opinion
Steven Schweda
Honored Contributor

Re: KSH to DCL command question - easy.

Alternatively, depending on what you actually
need to do (and how much infrastructure you
can't demand), it's possible to read and
re-write an altered file using DCL OPEN,
CLOSE, READ, and WRITE. Text editor scripts
are also used by people who can figure those
out.

Resource? I just type randomly until it
works. (Testing takes a long time, though.)
Stealing code from existing procedures is
also popular, but finding good ones is a
challenge.
Daniel Fernandez Illan
Trusted Contributor

Re: KSH to DCL command question - easy.

A good option equivalent of sed is to use EDIT/EDT/COMMAND DCL command.

Saludos.
Daniel.
Karl Rohwedder
Honored Contributor

Re: KSH to DCL command question - easy.

Beside the very good OpenVMS documentation the famous book "writing real programs in DCL" is very good (see http://books.kelkoo.co.uk/b/a/cpc_5101_ps_4027506_gs_16272260.html
e.g.).

regards Kalle
John Gillings
Honored Contributor

Re: KSH to DCL command question - easy.

re: Daniel,

>A good option equivalent of sed is to
>use EDIT/EDT/COMMAND DCL command.

Sorry Daniel, not a criticism of you... Could everyone PLEASE forget EDT exists?

EDT was made obselete more than 20 years ago by TPU and EVE. You can write EVE scripts or incredibly complex and powerful programs in TPU to do any kind of text processing anyone can dream up. EVE is a MUCH better, more reliable, more scalable and easier to drive editor than EDT.

If you really can't retrain your fingers from EDT commands, use EDT keypad mode. Yes OpenVMS will keep EDT around forever for compatibility, but that doesn't mean anyone actually has to USE it. EDT has enough quirks, unreasonable limitations, nasty surprises and outright bugs (none of which will ever be fixed) to make STRONG recommendations against using it.

Back to the original question... TPU can certainly do anything awk or sed can do.
A crucible of informative mistakes
Martin Vorlaender
Honored Contributor

Re: KSH to DCL command question - easy.

Allan,

I guess you could get all the functionality of awk and sed out of perl without too much hassle (as awk and sed were two of the "ancestors" of it).

You can get VMS Alpha and I64 kits from http://h71000.www7.hp.com/openvms/products/ips/apache/csws_perl_relnotes.html

HTH,
Martin
Ian Miller.
Honored Contributor

Re: KSH to DCL command question - easy.

John G, you will be telling people not to use TECO next :-)

Allan, see TPU manual
http://h71000.www7.hp.com/doc/73final/6020/6020pro.html
or in pdf
http://h71000.www7.hp.com/doc/73final/documentation/pdf/OVMS_73_DEC_TPU_REF.PDF

You can do what you what in TPU but if you are coming from a unix background you may find perl easier.

from the TPU manual
"DECTPU is a high-performance, programmable, text processing utility that includes the following:

* A high-level procedural language
* A compiler
* An interpreter
* Text manipulation routines
* Integrated display managers for the character-cell terminal and DECwindows environments
* The Extensible Versatile Editor (EVE) interface, which is written in DECTPU

DECTPU is a procedural programming language that enables text processing tasks; it is not an application.
____________________
Purely Personal Opinion
Allan Parsons
Advisor

Re: KSH to DCL command question - easy.

I am looking at implementing something without having to install additional libraries... so i dont think perl would be an option, nor GAWK.
Steven Schweda
Honored Contributor

Re: KSH to DCL command question - easy.

The responses might improve if you supplied
a list of constraints and some sample "awk"
and "sed" commands. For example, sometimes
these programs are used to extract a field
from the output of some program or other,
where on VMS, a lexical function would
typically be used.

Whether this is actually "easy" depends on
many things. (Everything's complicated.)
Sheldon Smith
HPE Pro

Re: KSH to DCL command question - easy.

'awk' and 'sed' were written in C, and C has been ported to just about every platform there is. While you could go to the effort of translating the scripts, it would be far far simpler to get VMS ports of awk and sed, then set up a DCL symbol for each. Why reinvent the wheel?
While it has been a few years since I worked with them on VMS, each was (and presumably still is) a single .EXE file.
And now that I write this, if you have TCP/IP Services for VMS installed, look for SYS$COMMON:[SYSHLP.EXAMPLES.TCPIP...]*AWK*.EXE*. If you find it, define the symbol awk to point to it.

Note: While I am an HPE Employee, all of my comments (whether noted or not), are my own and are not any official representation of the company

Accept or Kudo

Allan Parsons
Advisor

Re: KSH to DCL command question - easy.

Sheldon: Perfect, it is there! Do you know if SED is around, by default, anywhere?
Karl Rohwedder
Honored Contributor

Re: KSH to DCL command question - easy.

Hunter Goatley has SE listed under:
http://www.process.com/openvms/index.html

I never use it so I don't know its fittness.

There is also port a Gnu-AWK.

regards Kalle
Joseph Huber_1
Honored Contributor

Re: KSH to DCL command question - easy.


And as all other basic U*x utilities, awk and sed are in the GNV distribution.
http://www.mpp.mpg.de/~huber