Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy command in a com file

Status
Not open for further replies.

azhrei

MIS
Dec 31, 2002
4
US
I'm trying to do a copy with asterisks in a com file as shown below

$ copy/log prpohclaims:rpoh*.txt prpohclaims:'tdate'_*.txt

and I get the following:

$ copy/log prpohclaims:rpoh*.txt prpohclaims:rpoh*_030312.txt
%COPY-F-OPENOUT, error opening PRPOHCLAIMS:RPOH*.TXT as output
-RMS-F-FNM, error in file name


any ideas why?

thanks
Paul
 
You cannot use a wildcard in the destination filename to replace only part of the name. You either have to specify the filename directly, or keep it exactly the same as the source filename. If I'm reading your code correctly, you are trying to make a copy of each file, but adding the current date to the destination file name. Here is one way you can accomplish this. Not sure if I have all of the syntax correct, and you should double check that I have the correct parameter (NAME) on the F$PARSE statement. Also, keep in mind that if you run this procedure more than once without moving/deleting the files it created the first time, you will get duplicates of those as well (i.e. fn_030313_030313.txt). I'd suggest renaming/moving/deleting the original file upon a success copy, and create the copy in a new directory to prevent this from happening. I have not included that in the code below. Hope this helps.

$ DIR/OUTPUT=DIR_LIST.TXT/COL=1/NOHEAD/NOTRAIL/BEFORE=TODAY -
/EXC=*.DIR PRPOHCLAIMS:RPOH*.TXT;*
$!
$ OPEN/READ DIR_FILE DIR_LIST.TXT
$!
$ NEXT_RECORD:
$ READ/END_OF_FILE=DONE DIR_FILE FILE_NAME
$ CREATION_DT == F$CVTIME(F$FILE_ATTRIBUTES("''FILE_NAME'","CDT"))
$ FMT_CREATION_DT == F$EXTRACT(2,4,CREATION_DT)+F$EXTRACT(5,2,CREATION_DT)+ -
F$EXTRACT(8,2,CREATION_DT)
$ FN == F$PARSE("''FILE_NAME'",,,"NAME")
$ NEW_FN == "''FN'"+"_"+"''FMT_CREATION_DT'"
$ NEW_FILE_NAME == "PRPOHCLAIMS:''NEW_FN'.*;"
$ COPY 'FILE_NAME' 'NEW_FILE_NAME'
$ GOTO NEXT_RECORD
$!
$ DONE:
$ CLOSE DIR_FILE
$ DELETE DIR_LIST.TXT;*

 
thanks I was finally able to figure out that I couldn't use a partial wildcard :-( and was going to settle on the ending to be the date. but that meant one more file to ftp over to the file server. I suppose it would of helped to include more text. I will below, for clarification of everything needed. thanks again

Paul


$set verify
$! pjobs:ftp_rpoh_claims.jobd Paul Coviello 3/11/2003
$!
$! FTP rpoh claims to the t drive
$!
$!
$set noon
$show time
$set proc/priv=all
$!
$! Keep a copy of all todays files for one day in case this com file
$! deletes something that shouldn't be deleted
$!
$!
$!Set up symbols:
$ DATE1 = F$FAO("!2ZW", F$INTEGER(F$CVTIME(F$TIME(),,"DAY")))
$ DATE2 = F$FAO("!2ZW", F$INTEGER(F$CVTIME(F$TIME(),,"MONTH")))
$ TODAY = DATE2 + DATE1
$ day_of_week=f$extract(0,3,(f$cvtime(,,"weekday")))
$ write sys$output day_of_week
$ YR=F$CVTIME(,,"YEAR")
$001_continue:
$!
$!Copy yesterdays files into archive directory then clear out files
$!from todays_files directory
$!
$ purge/keep=5 plogs:ftp_rpoh_claims.log
$!
$ dir/date/size prpohclaims:rpoh*.txt
$!
$ copy/log prpohclaims:rpoh*.txt prpohclaims:*.'tdate'
$!
$ copy/log prpohclaims:rpoh*.'tdate' dsa2:[pps.rpohclaims.archive]*.*
$!
$ delete/log/before="-90-00:00:00" dsa2:[pps.rpohclaims.archive]rpoh*.*;*
$!
$!-----------------------------------------
$!
$ SHOW TIME
$!
$!Transfer via "FTP" to FTPSERVE - t drive
$!
$
$set def dsa2:[pps.rpohclaims]
$dir rpoh*.'tdate'/size/date
$!
$set proc/priv=all
$!
$! Extra connect because sometimes 1st connect fails
$ftp
connect node
set default t:\MSO\EPIC\RPOH
dir
exit
$ftp
connect node
set default t:\MSO\EPIC\RPOH
dir
put rpoh*.*
dir
exit
$!
$! Archive to EpicData
$ftp
connect
set default v:\Archive\Claims
dir
put rpoh*.*
dir
exit
$!
$del/log rpoh*.*;*
$!
$set noverify
$!
$ MAIL/SUBJECT="FTP_CLAIMS" PJOBS:FTP_RPOH_CLAIMS.'tdate'
"@SYS$COMMON:[SYSMGR]SYSMGR.DIS
"
$!
$exit




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top