- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: UNIX procedure equivalent in OVMS?
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
тАО11-29-2005 08:24 PM
тАО11-29-2005 08:24 PM
I'm a newbie to VMS scripting and i would greatly appreciate if someone would offer me some solutions here.
I've been trying to perform the following procedure in OpenVMS as i've done well in UNIX.
foreach file (`ls
mem del $file
end
What exactly i'm trying to do here is to capture a list of existing files in a specified directory and delete those same files residing in a connected industrial machine. The statement "mem del" is basically delete files in the machine's memory.
On top of this, there's another problem with VMS. I noticed when i performed a "directory" command on a location. All the files comes with a version number at the end. This would pose a problem when i try to use the filenames to delete in my machine's memory. In this case, i would need to truncate the trailing version numbers.
How can i get these done with similar commands which i'd used in my UNIX script? Please help....please?!
Augustine Andrew
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2005 08:30 PM
тАО11-29-2005 08:30 PM
Re: UNIX procedure equivalent in OVMS?
-----
$LOOP:
$ FNAM = F$SEARCH ("*.*;*")
$ if FNAM .eqs. "" then $ goto DONE
$! delete 'FNAM'
$ write SYS$OUTPUT FNAM
$ goto LOOP
$DONE:
$ exit
-----
> All the files comes with a version number at the end. This would pose a problem when i try to use the filenames to delete in my machine's memory.
You MUST specify a version number (or the "*" wildcard) in order to be able to delete a file.
> i would need to truncate the trailing version numbers.
In case you need this for something else - use:
$ directory *.*; /select=file=noversion /column=1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2005 08:40 PM
тАО11-29-2005 08:40 PM
Re: UNIX procedure equivalent in OVMS?
If you want to check the files in a directory, use f$search, and you can check the help with
$ help lexical f$search
an example
$ loop:
$ file = f$search("my_directory:*.dat")
$ if file.eqs."" then exit
$ !your code about that file, here a search (grep in Unix) ...
$ search 'file my_string
$ goto loop:
With f$search, if you do several concurrent searches, you will use the stream id (here 1 and 2)
$ START:
$ COM = F$SEARCH ("*.COM;*",1)
$ DAT = F$SEARCH ("*.DAT;*",2)
$ SHOW SYMBOL COM
$ SHOW SYMBOL DAT
$ IF (COM.EQS. "") .AND. (DAT.EQS. "") THEN EXIT
$ GOTO START
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2005 08:49 PM
тАО11-29-2005 08:49 PM
Re: UNIX procedure equivalent in OVMS?
to get only the file name for use in remote specification use F$PARSE. [may be omit the version]
FNAMSHORT = f$PARSE(FNAM,,,"NAME") + f$PARSE(FNAM,,,"TYPE") [ + f$PARSE(FNAM,,,"VERSION") ]
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-29-2005 11:42 PM
тАО11-29-2005 11:42 PM
Re: UNIX procedure equivalent in OVMS?
residing in a connected industrial machine. The statement "mem del" is basically delete files in the machine's memory.
The way I interpret your question: "at the VMS system there is a directory in which files reside, copies of which exist in the memory of the connected machine".
If so:
- what is the OS of those machines?
- do you just need to remove the memory copies, or also the VMS files?
How to get the list of files is by any of the given methods.
If you just beed a list, I would use the last line given by Uwe, perhaps with the addition of /NOHEADER and /NOTRAILER.
Put that in a file ( /OUTPUT= filename ). or use PIPE, to feed your original example.
If you also want to delete the VMS file, then use the file mechanism. You have to add the version number again (use wildcard, ;* ) for a VMS DELETE.
If there is no need to remove both synchronously, use the PIPE method, and for VMS just delete the whole bunch at one go: DELETE *.*;*
hth,
Success
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 04:30 AM
тАО11-30-2005 04:30 AM
Re: UNIX procedure equivalent in OVMS?
You can also select files with
$ delete /before=
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 06:36 PM
тАО11-30-2005 06:36 PM
Re: UNIX procedure equivalent in OVMS?
Wow! This is like family! What prompt response we have here?! You guys are great!
But anyway, i still have some problems after trying out your wonderful suggestions.
============================================
Hi Uwe,
Your idea works. But i've a problem when i need to delete the list of files generated by the F$SEARCH function in a different directory. FNAM returns the full directory path of the search list. Hence, i wouldn't be able delete the same files in any other directory other than the original search location. Do you have a fix on this small glitch?
On the other hand, your truncation method doesn't work on my machine.It seems like mine doesn't support the 'file' keyword.
*[%DCL-W-IVKEYW, unrecognized keyword - check validity and spelling
\FILE\]
How do i check the version of my OVMS for scripting compatibility? I felt that my OVMS's scripting language works a little different. Hmm...strange!
============================================
Hi Labadie,
Thanks for your ideas too!
"Mem Del" is not a OVMS command, it's my other machine's command. It doesn't matter.
Thanks!
============================================
Hi Mike,
Thanks for your command there although i don't understand it.
The command line works for me, but it returns an error msg when i invoke it.
*[%DCL-W-SYMDEL, invalid symbol or value delimiter - check command syntax]
What is this all about?
============================================
Hi Jpe,
Yes, you've got my point.
The OS of my connected machine doesn't matter. It's making use of OVMS to communicate with it. I only need to delete the memory copies in that machine using the "mem del" command. No issues with that.
Sorry, i may sound stupid but how do i utilize the /NOHEADER & /NOTRAILER qualifiers to Uwe's command?
/OUTPUT doesn't seemed to work on my OVMS. My OVMS works a little different from others, i think.
============================================
Best Regards,
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 07:30 PM
тАО11-30-2005 07:30 PM
SolutionYour alter ego on computing.net specified a bit more precisely that You have VMS 5.5 !
And in this ANCIENT version there was rarely a /output qualifier for commands.
So You have to redirect output of the dir command by
define/user sys$output somename.tmp
dir ...
to achieve the same as dir/output=somename.tmp .
And as I have said in computing.net, parse the file-specification into nt=name+type, then
delete thedisk:[thedirectories]'nt';*
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-30-2005 08:11 PM
тАО11-30-2005 08:11 PM
Re: UNIX procedure equivalent in OVMS?
Attached command procedure works for me.
Note that I haven't tested it thoroughly.
Regards,
Kris (aka Qkcl)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2005 07:44 AM
тАО12-01-2005 07:44 AM
Re: UNIX procedure equivalent in OVMS?
So, VMS 5.5, and the procedure runs on VMS, to operate on the remote system, and the directory over there is different (say: remdir)
(supposing MEM DEL is doing the same as on *X:)
$ DEFINE SYS$OUTPUT DIRLIS.TMP
$ DIRE
$ OPEN IFI DIRLIS.TMP
$LOOP:
$ READ IFI FIL /END=DONE
$ REMFIL =
$ MEM DEL 'REMFIL'
$ !? DELETE 'FIL' !? maybe local del as well?
$ goto loop
$DONE:
$ CLOSE IFI
$ DELETE DIRLIS.TMP.*
hth
Proost.
Have one on me.
jpe