Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Help required for Open VMS Scripting

Occasional Visitor

Help required for Open VMS Scripting

HI,

I am having a very hard time with scripting in OPEN VMS

I have a certain output in a file called test.txt .For example :

 

[WWEWE@http-lx-as code]$ cat test.txt
** Configuration for file "MULTINET:NETWORK_DEVICES.CONFIGURATION" **

Device                           Adapter   CSR Address  Flags/Vector

------                           -------   -----------  ------------

se0  (Shared VAX/VMS Ethernet)   -NONE-    -NONE-       -NONE-

s10  (Serial Line IP)            -NONE-    -NONE-       -NONE-

dn0  (IP over DECNet link)       -NONE-    -NONE-       -NONE-
==========================================================================================

I have written a script in Linux which helps to pick up all the information under the device column in this case se0,s10,dn0.

Can we do a similar thing in OPEN VMS

 

The Linux script is as follows :

SCRIPT :

 

for i in `cat test.txt 2>/dev/null |egrep '^[a-z]' |grep -v '\*\*' | awk '{print $1}'`
> do
>     echo Begin-interface: $i
> done

 


OUTPUT :

 

Begin-interface: se0
Begin-interface: s10
Begin-interface: dn0

 

Let me know if it can be achieved,

Thanking you in advance

5 REPLIES
Honored Contributor [Founder]

Re: Help required for Open VMS Scripting

 
Occasional Visitor

Re: Help required for Open VMS Scripting

Wow Steven this is great :)

Will this work on Multinet systems as well and if instead of a file we have to take the output from a command.

For example for the "SHOW System" command if we have to get all the list of PIDs then will doing some modifications in the first line of your mentioned script be helpful.

This is awesome stuff thanks a lot..I will try my hands on it and let you know whether I could get it to work as I want to.

 

Honored Contributor [Founder]

Re: Help required for Open VMS Scripting

 
Honored Contributor [Founder]

Re: Help required for Open VMS Scripting

If you want to get details of your system configuration (including multinet) for use elsewhere 

you can use the VMS_Check tool - see this page for how to get and install it.

http://h71000.www7.hp.com/openvms/journal/v7/vms_check_tool.html

 

If you have a more specific requirement for your script

you could also look at the command procedures in this tool for clues as to how to proceed.

 

Phil  

 

Highlighted
Honored Contributor [Founder]

Re: Help required for Open VMS Scripting

A little late...

Heed gthe advise given. Many tasks you are about to do poorly (judging by the unix code example) have been done before and have been done better. Hunt for good examples!

 

You can install GAWK and/or GNV+AWK on OpenVMS. Thus you can solve the original question with:

 

$! Look for a number, followed by spaces and an open parenthesis to identify interface line.

$ gawk /comm="/[0-9] *\(/ {print ""Begin-interface:"",$1}" tmp.tmp

 

In a similar fashion the list of pids can be obtained using

 

$ pipe show system | gawk/comm="NR > 2 {print NR,$1}" sys$pipe

or

$ pipe show system | perl -lane "print $F[0] if $. > 2"

or sorted, using eskimo kiss to seperate loop from end section...

$ pipe show system | perl -lane "push @pids,$F[0] if $. > 2  } {  print for (sort @pids) "

 

fwiw,

Hein