Operating System - OpenVMS
1826554 Members
3924 Online
109695 Solutions
New Discussion

a question about getting files from VMS to Windows

 
SOLVED
Go to solution
Davor_7
Regular Advisor

a question about getting files from VMS to Windows

Hi all
these files are in VMS
file.log;3
file.log;2
file.log;1

i want to get these 3 files into my Windows directory.
i write a BAT file to "ftp" to the VMS server and "mget" those files.
but... it will only get the newest file(file.log;3)
how to get all the files and make them different name in Windows?

what would you do in this situation?
thanks!
7 REPLIES 7
Hein van den Heuvel
Honored Contributor
Solution

Re: a question about getting files from VMS to Windows


You can not do it with the mget command.
The get takes an input filename and output filename as argument, but then you need to know what is coming.

Do you have any control over the application that creates these files?

I would recommend solving this on the vms side with a (batch) you to rename them before the transfer.

You might get away with a simple version number in the name part of the file name, but i would consider adding a date and/time stamp while at it.

Sample rename script

$blank = ""
$version = 0
$name = f$parse (p1,,,"NAME","syntax_only")
$type = f$parse (p1,,,"TYPE","syntax_only")
$if name.eqs.blank.or.type.eqs.blank then exit
$new_name = name + "_"
$out_loop:
$file = f$search(new_name+"*"+type)
$if file.eqs.blank then goto in_loop
$x = f$parse (file,,,"NAME","syntax_only") - new_name
$if 'x.gt.'version then version = 'x
$goto out_loop
$in_loop:
$file = f$search(name+type+";-0")
$if file.eqs.blank then exit
$version = version + 1
$rename/log 'file 'new_name''version''type'
$goto in_loop

same thing in Perl is not too pretty:

($name,$type)=split(/\./,@ARGV[0]);
while (glob($name."_*.".$type)) {
if (/^${name}_(\d+)/) {$version = $1 if ($1 > $version) };
}
$x++;
while ($x--) {
while (glob(@ARGV[0].";-0")){
$x++;
print "== $_\n";
$version++;
$new = $name ."_".$version.".".$type;
print "$_ -> $new\n";
rename $_, $new;
}
}


fwiw,
Hein.

Peter Quodling
Trusted Contributor

Re: a question about getting files from VMS to Windows

Generally you are SOL (S***t out of luck.) FTP assumes O/S's that aren't version number aware - lowest common denominator.

Doing a quick poke around the net, apparently the SCP2 protocol that comes with SSH (not the SCP1) supports versioning. Some clients for this, such as Process SW's support versions with a /vms qualifier on the command. (albeit on a VMS box)

You may want to poke around some of the SCP/SFTP clients for windows to see if they support this. (I use winscp, but that system isn't net connected at the moment, so cannot check easily... )

q
Leave the Money on the Fridge.
Willem Grooters
Honored Contributor

Re: a question about getting files from VMS to Windows

Have you tried to do

FTP> mget file.log;*

or

FTP> get file.log;1
FTP> get file.log;2
FTP> get file.log;3

or use a product like WS-FTP (see www.ipswitch.com), this can handle VMS files including multiple versions. I found it has some problems with ODS-5 filespecs but in newer versions that I currently use, these issues may have been solved. For ODS-2 disks however, it's fine.

Another approach I often use is to ZIP the files on VMS (see freeware CD if www.info-zip.org), zip the file BINARY to Windows and unzip there. The files must now be opened using Wordpad or Word, Notepad cannot handle them properly.

Willem
Willem Grooters
OpenVMS Developer & System Manager
Ian Miller.
Honored Contributor

Re: a question about getting files from VMS to Windows

does the windows ftp client list all the files? (the ftp server on vms can be configured to only show the latest version and supress version numbers).
____________________
Purely Personal Opinion
Colin Butcher
Esteemed Contributor

Re: a question about getting files from VMS to Windows

Ensure that the log files are generated with unique names.

Run a rename procedure to enforce that if needed, certainly do that as a one off conversion process.

Run a tidy-up procedure as often as needed to delete old logs (by date, by name, whatever)

I did one find a VMS system where someone had enforced single versions by simply doing SET FILE/VERSION_LIMIT=1 and SET DIRECTORY/VERSION_LIMIT=1 on every disc, including the system disc. Crazy!

As has already been mentiond - WS-FTP Pro from Ipswitch seems to behave fairly well as a PC FTP client when transferring between VMS systems and PCs. It also has the ability to convert extensions on-the-fly, for example I get it to automatically convert from .COM at the VMS end to .COM_VMS at the PC end.
Entia non sunt multiplicanda praeter necessitatem (Occam's razor).
Sebastian Bazley
Regular Advisor

Re: a question about getting files from VMS to Windows

You can use the following on VMS:

zip -lw file.zip file.log;*

-l converts LF to CRLF so files read OK on Windows
-w stores VMS file versions

However, I agree that the best is to ensure that the files have unique names in the first place...
Davor_7
Regular Advisor

Re: a question about getting files from VMS to Windows

thanks all :)
i temporarily close this thread, sorry~