1827391 Members
4920 Online
109965 Solutions
New Discussion

DCL Scripting

 
SOLVED
Go to solution
GNJ
Advisor

DCL Scripting

Hi
Can I know How can I do them?
1)different ways to redirect the output of a
dcl command to a file
2)To grep all the lines (from a file)with a perticular string/Word and redirect the output to a file


Regards
Jayakrishnan G Naik
14 REPLIES 14
Hein van den Heuvel
Honored Contributor
Solution

Re: DCL Scripting

1) Check HELP

1.1) Many commands have build in redirection
$ /OUT=

1.2) Re-direct sys$output through temporary logical
$define/user sys$output
$

1.3) Place commands in script, capture script triggered output
$@<script>/out=

1.4) Pipe, line Unix, but costs a sub-process
$pipe >

1.5) Use terminal session log
$set host 0::/log=

2)
2.1) As per 1.1, use build in redirect
$search /MATCH=xxx /OUT=

2.2) As per 1.4, pipe
$pipe searc | sys$pipe ...

Hope this helps
Hein van den Heuvel
HvdH Performance Consulting
GNJ
Advisor

Re: DCL Scripting

Hi
Thank you for the valuable info
I havesome doubts in the below commands
in 2.1 what does this do?-/MATCH=xxx

in 2.2)| sys$pipe ... what is happened after the pipe symbol?

2.1) As per 1.1, use build in redirect
$search /MATCH=xxx /OUT=

2.2) As per 1.4, pipe
$pipe searc | sys$pipe ...


Regards
Jayakrishnan G Naik
GNJ
Advisor

Re: DCL Scripting

Hi
I got the output as I needed in a file
I need to send that file to my mail id?
How can I add this in script?

Is there any way to make this output in excel format so that I can open this file
with excel?

I need to periodically run this script say
once in a week how to put it in que to run
weekly?

Can you please let me know how Can I do this?

Thanks & Regards
Jayakrishnan G NAIK
Hein van den Heuvel
Honored Contributor

Re: DCL Scripting

>> in 2.1 what does this do?-/MATCH=xxx

Use the force: $HELP SEARCH /MATCH
The xxx stands for specific matching (such as AND or XOR) to do when multiple word are provided. My implied suggestion is the you should look at that as alternative for the typical multiple pipes used for complex greps:
#grep x | grep y | grep -v z


>> in 2.2)| sys$pipe ... what is happened after the pipe symbol?

Whatever you fancy! The thought there is that you probably put the output into a file for a reason. If that reason is further processing, then this is possibly better done in redirected through a pipe

Regards
Hein.
Karl Rohwedder
Honored Contributor

Re: DCL Scripting

To mail the file you just do a :

$ MAIL filename.ext mailid

(See HELP MAIL for more info and qualifiers).

If you need an EXCEL compatible format, you will have to convert the file yourself.

regards Kalle
Karl Rohwedder
Honored Contributor

Re: DCL Scripting

Regarding regular jobs:

Pls. search the forum, as there have been many threads covering this topic.

regards Kalle
Hein van den Heuvel
Honored Contributor

Re: DCL Scripting

As Karl indicates, be sure to searcg the forum (or the world!) for prior answers:
google +site:itrc.hp.com


Simple example of mail:

$ pipe show dev d | search sys$pipe mounted | mail/sub=mounted sys$pipe

Simple example of CSV for same data:

$ pipe show dev d | perl -lne "if (/Mounted/){print join("","",(split))" | mail/sub=mounted sys$pipe

Hein.




GNJ
Advisor

Re: DCL Scripting


Hi

I need to periodically run this script say
once in a week how to put it in que to run
weekly?

Can you please let me know how Can I do this?

How to do "Cut", "sed" kind of operations
in dcl scripts?


Regards
Jay
Joseph Huber_1
Honored Contributor

Re: DCL Scripting

For periodical jobs, please follow the advice, this has been discussed several times in the past here.

For short, a weekly job can submit itself by
submit/after=("today+7-3") 'f$environment("procedure")'

today+7 means in once week, and -3 means at 3:00h .

In addition to reading the VMS FAQ, see HELP DCL date, HELP LEXICAL F$ENVIRONMENT.

What do You mean "Cut" ? If You mean "cat","sed":
these are Unix utilities, and made available to VMS via the GNV open source project.
See software/open source from the HP Openvms home page how to get GNV.
http://www.mpp.mpg.de/~huber
labadie_1
Honored Contributor

Re: DCL Scripting

the dcl equivalent of the linux command "cut" is f$extract

see

$ help lex f$extract

You have awk under Vms, define
gawk :== $ SYS$COMMON:[SYSHLP.EXAMPLES.TCPIP.SNMP]gawk.exe

For sed, I do no know a Vms equivalent
Martin Vorlaender
Honored Contributor

Re: DCL Scripting

>>>
For sed, I do no know a Vms equivalent
<<<

Hunter Goatley has ist in his archive: http://vms.process.com/scripts/fileserv/fileserv.com?SED

cu,
Martin
Hein van den Heuvel
Honored Contributor

Re: DCL Scripting

>> How to do "Cut", "sed" kind of operations
in dcl scripts?

perl

DCL scripting is a 'whole new world'. Embrace it, don't fight it.
Think DCL, don't think cut/sed/wc/grep...
READ the fine manuals, READ the HELP.
Do NOT try to translate Unix Shell solutions into DCL scripts.

As labadie writes, where a unix person thinks 'cut', A DCL scrill will probably need F$EXTRACT (think substr) for fix positions of F$ELEMENT (think split) for delimited strings.

'sed' will be tricky. There is no easy string replacement, but in 25+ years of DCL programming I rarely missed it. You would send to rebuild a new string from piece rather than replace.

$ new = f$elem(0,"-",old) + "-xx-" + f$elem(2,"-",old)

For fixed length strings, replace in place:
$ name[4,3] := "xxx"


But you should possibly use Perl or Awk to massage lots of data.

For further and better help, why don't you describe a specific example in more detail.
Output from which command?
Sample output inline AND in a .txt attachment
Which trnasformations?
Sample result inline AND in same .txt attachment.

hth,
Hein van den Heuvel
HvdH Performance Consulting





Andy Bustamante
Honored Contributor

Re: DCL Scripting


The fine doc set is available at http://h71000.www7.hp.com/doc/

If you're getting started and don't have someone available, you may consider some of the third party books.

http://www.amazon.com/Writing-Real-Programs-DCL-Technologies/dp/B000FO58MG/sr=8-1/qid=1172250047/ref=sr_1_1/104-7423816-8530324?ie=UTF8&s=books
http://www.amazon.com/OpenVMS-System-Management-Guide-Technologies/dp/1555582435/sr=8-2/qid=1172250047/ref=sr_1_2/104-7423816-8530324?ie=UTF8&s=books
http://www.openvms.org/pages.php?page=Books


Andy
If you don't have time to do it right, when will you have time to do it over? Reach me at first_name + "." + last_name at sysmanager net
Jan van den Ende
Honored Contributor

Re: DCL Scripting

Jayakrishnan,

from your Forum Profile:


I have assigned points to 6 of 22 responses to my questions.


Maybe you can find some time to do some assigning?

http://forums1.itrc.hp.com/service/forums/helptips.do?#33

Mind, I do NOT say you necessarily need to give lots of points. It is fully up to _YOU_ to decide how many. If you consider an answer is not deserving any points, you can also assign 0 ( = zero ) points, and then that answer will no longer be counted as unassigned.
Consider, that every poster took at least the trouble of posting for you!

To easily find your streams with unassigned points, click your own name somewhere.
This will bring up your profile.
Near the bottom of that page, under the caption "My Question(s)" you will find "questions or topics with unassigned points " Clicking that will give all, and only, your questions that still have unassigned postings.
If you have closed some of those streams, you must "Reopen" them to "Submit points". (After which you can "Close" again)

Thanks on behalf of your Forum colleagues.

PS. - nothing personal in this. I try to post it to everyone with this kind of assignment ratio in this forum. If you have received a posting like this before - please do not take offence - none is intended!

PPS. - Zero points for this.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.