- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Writing DCL script to sftp the recent created 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
тАО10-14-2009 03:38 PM
тАО10-14-2009 03:38 PM
Writing DCL script to sftp the recent created file from the directory
I want to write one dcl script which can fetch the latest/recent file from the directory and sftp the file to other windows system.The file format is as below
HPSEC_node.txt_101009;1
The script should search recent file in the existing directory.
Regards,
Sumant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 04:17 PM
тАО10-14-2009 04:17 PM
Re: Writing DCL script to sftp the recent created file from the directory
You have my permission. Is something (else)
stopping you?
write sys$output f$getsyi( "version"), f$getsyi( "arch_name")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 04:35 PM
тАО10-14-2009 04:35 PM
Re: Writing DCL script to sftp the recent created file from the directory
Use F$SEARCH to find files, then F$FILE_ATTRIBUTES to determine file dates (you don't specify which date you're interested in, created, modified, accessed, etc...). Use F$CVTIME to convert a date/time into a format that can be compared.
On the other hand, perhaps the filespec you've posted means there's a date stamp embedded into the file extension? (never heard of Y2K?) You can extract that string using F$PARSE and string subtraction:
$ date=F$PARSE(file,,,"TYPE")-".txt_"-".TXT_"
Is that ddmmyy or mmddyy? Realise that neither of those formats can be compared using a normal string comparison, so you'll need to normalise them into yymmdd. Use F$EXTRACT to pull pieces of string. Assuming ddmmyy:
$ date=F$EXTRACT(4,2,date)+ F$EXTRACT(2,2,date)+ F$EXTRACT(0,2,date)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 07:13 PM
тАО10-14-2009 07:13 PM
Re: Writing DCL script to sftp the recent created file from the directory
Dir name
dka0:[tmp]hp_node.txt_date;1
Each day system creates the file so i need to extract the recent file to do sftp to another node.I am not very good in writing dcl scripts hence i need your help.
Regards,
Sumant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 09:48 PM
тАО10-14-2009 09:48 PM
Re: Writing DCL script to sftp the recent created file from the directory
dka0:[tmp]hp_node.txt_date;0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2009 09:50 PM
тАО10-14-2009 09:50 PM
Re: Writing DCL script to sftp the recent created file from the directory
> hence i need your help.
For money you can hire someone who is better,
but you would probably need to give him a
clearer explanation of what you wish to do.
> Use F$SEARCH to find files, [...]
That's probably the way I'd try. Have you
tried anything, or are you waiting for
someone else to do your job for you?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2009 04:24 AM
тАО10-15-2009 04:24 AM
Re: Writing DCL script to sftp the recent created file from the directory
Welcome to the Forum. If you are not familiar with DCL (or OpenVMS) then you probably would benefit from professional help. However, looking at your post, you really are facing two problems.
1. Identifying the file to transfer,
and 2. Doing the transfer from within your script.
In order to solve the identification problem , we need certain pieces of information. For example,
1. is there only going to be one (1) file created each day?
2. will the file ALWAYS be created daily and will this be at a specific time"
3. alternatively, will there be multiple files created daily, of which you only want the most recent? (You know that OpenVMS creates multiple versions of files (?))
The solution to the sftp part of the problem will depend on the TCPIP stack you are using.
------------------------
If there is only going to be one file created each day, then you know what name the file will have, so construct the filename and then look for it. i.e.
(and I assume that "node" needs to be replaced by system nodename)
$ Node = f$getsyi("Nodename")
$ Year = f$extr(2,2,f$cvtime(f$time(),"ABSOLUTE","YEAR"))
$ Month = f$cvtime(f$time(), "COMPARISON","MONTH")
$ Day = f$extr(2,2,f$cvtime(f$time(),"ABSOLUTE","DAY")
$ Date = "''Month'''Day'''Year'"
$ FileName = "HPSEC_''Node'.txt_''Date'"
$ show symb filename
FILENAME = "HPSEC_BUD.txt_101509" (in my case)
to get the "full path spec" of the most recent version,
$ FileName = f$search(FileName,)
$ show symb filename
FILENAME = "USERROOT:[SYSDAB.EON]HPSEC_BUD.TXT_101509;3" (in my case)
If you can get your script to this point, then you are close to the second problem which is the "sftp" step.
get back to us then.
HTH
Dave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2009 06:26 PM
тАО10-18-2009 06:26 PM
Re: Writing DCL script to sftp the recent created file from the directory
Thanks for your all assistance ,just to inform you that with help of my one team member created below script.Its doing his job.
We created 2 dcl scripts for get-sftp & put-sftp
$ set noon
$ tod=f$cvtime("",,"weekday")
$ today=f$edit(tod,"UPCASE")
$ IF TODAY .EQS. "SUNDAY" THEN GOTO RESUBMIT
$ SET DEF CDB_DAT
$ sftp "-B" get-bb.com user-id@ip address
$ sho sym $status
$ RESUBMIT:
$SUBMIT/KEEP/USER=system/AFTER="TOMORROW+19:50" SYS$LOGIN:sftp-get-ib
$ PURGE SYS$LOGIN:SFTP-GET-ib.LOG/KEEP=31
$ EXIT
Regards,
Sumant