- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Diplaying TOP 10 messages of a file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2005 09:49 PM
тАО12-05-2005 09:49 PM
Re: Diplaying TOP 10 messages of a file
on your VMS version, you are practically restricted to:
$ TYPE /TAIL=<#-of-lines>
$ MAIL SYS$LOGIN:TAILTYPE.TMP
$ DELETE SYS$LOGIN:TAILTYPE.TMP;*
hth
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2005 09:57 PM
тАО12-05-2005 09:57 PM
SolutionI wrote 2 versions of a small hack. First example selects the first ten lines of a given file and sends it to a mail address. In both examples You must substitute the mail adress (xy) with Your own address.
$! Copies first 10 Lines of a file into a temporary file and sends this file to mail_address
$!
$ ON CONTROL_Y THEN GOTO clean_up
$ unique_filename = F$UNIQUE()
$ mail_address = "xy"
$ max_lines = 10
$ IF P1 .EQS. "" THEN INQUIRE P1 "Enter File Name "
$ IF F$SEARCH(P1) .EQS. ""
$ THEN
$ WRITE SYS$OUTPUT "File ''P1' not found "
$ GOTO clean_up
$ ENDIF
$ OPEN/READ in 'P1'
$ OPEN/WRITE out 'unique_filename'.dat
$r_loop:
$ READ/END_OF_FILE=end_file in record
$ WRITE out record
$ max_lines = max_lines -1
$ IF max_lines .GT. 0 THEN GOTO r_loop
$!
$end_file:
$ CLOSE in
$ CLOSE out
$ MAIL/SUBJECT=test 'unique_filename'.dat 'mail_address'
$clean_up:
$ IF F$TRNLNM("in") .NES. "" THEN CLOSE in
$ IF F$TRNLNM("out") .NES. "" THEN CLOSE out
$ DELETE 'unique_filename'.dat;*
$ EXIT
Second example writes the 10 last lines of a file into a temporary file and sends it by email
$! Creates a temporary file which contains the last ten lines of a given file. Se
$! sends the temporary file by mail
$!
$ ON CONTROL_Y THEN GOTO clean_up
$ mail_address = "xy"
$ IF P1 .EQS. "" THEN INQUIRE P1 "Enter Filename "
$ IF F$SEARCH(P1) .EQS. ""
$ THEN
$ WRITE SYS$OUTPUT "File ''P1' not found "
$ GOTO clean_up
$ ENDIF
$ unique_filename = F$UNIQUE()
$ TYP/TAIL=10 'P1'/OUT='unique_filename'.dat
$ MAIL/SUBJECT=test 'unique_filename'.dat 'mail_address'
$clean_up:
$ IF F$SEARCH("''unique_filename'.dat") .NES. "" THEN DELETE 'unique_filename'.dat;*
Hope that helps.
Heinz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2005 11:17 PM
тАО12-05-2005 11:17 PM
Re: Diplaying TOP 10 messages of a file
look at his previous post: he is at VMS 7.1, so no F$UNIQUE available!
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2005 11:20 PM
тАО12-05-2005 11:20 PM
Re: Diplaying TOP 10 messages of a file
from your Forum Profile:
I have assigned points to 63 of 140 responses to my questions.
Some of those are rather old.
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.
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!
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2005 12:34 AM
тАО12-06-2005 12:34 AM
Re: Diplaying TOP 10 messages of a file
On vms 7.1 just change the line
unique_filename = F$UNIQUE()
to
unique_filename ="temp_file_''F$GETJPI("","PID")'"
That will solve the problem with the missing F$UNIQUE Lexical
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2005 02:04 PM
тАО12-06-2005 02:04 PM
Re: Diplaying TOP 10 messages of a file
If your system supports the PIPE command you don't need an intermediate file:
$pipe type/tail=10 more_test.tmp | mail/subj="testing" sys$pipe hein
Unfortunately this TYPE/TAIL fails on STM_LF files with:
-SYSTEM-E-UNSUPPORTED, unsupported operation or function
-RMS-F-ORG, invalid file organization value
That's really silly because it is trivial to implement, but there you have it.
The workaround is to use an intermediate file, but then we're back to having to name that. (And no, $type/page does not work on a pipe :-( ).
In the thinking outside the box solutions, I thought the following might work:
$ i = 0
$open/read x test.tmp
$open/read y test.tmp
$loop1:
$read x x
$i = i + 1
$if i.lt.10 then goto loop1
$
$loop2:
$read/end=send_mail x x
$read y y
$goto loop2
$
$send_mail:
$mail/subj="last 10" y hein
$!type y
$close x
$close y
Well... it works for $type, but not for $mail ?!
Hein.
- « Previous
-
- 1
- 2
- Next »