HP OpenVMS Systems

ask the wizard
Content starts here

Debugging DCL RENAME Error?

» close window

The Question is:

 
We are running a command procedure periodically which does the following rename:
 
IF F$SEARCH("DISK$DISK0:[IAPROD.SIDATA.FINAID]PGDA03BK.*") .NES. "" THEN -
RENAME/LOG DISK$DISK0:[IAPROD.SIDATA.FINAID]PGDA03BK.* -
DISK$DISK0:[IAPROD.SIDATA.FINAID.ARC]PGDA03BK_PROCESSED.*
 
When there are multiple file types within the file, called PGDA03BK (ex.:
 PGDA03BK.072 and PGDA03BK.073), files are renamed, but if there is only 1 file
 (ex.:PGDA03BK.072) then the file does not get renamed.
 
Is the syntax of the rename command incorrect?.
 
Thank you,
William G. Kassar
 
 


The Answer is :

 
  This appears to be expected behaviour.
 
  Please follow the directions in the DCL manual for (re)establishing
  the wildcard context for F$SEARCH -- the RENAME syntax used does
  appear to be correct.
 
  Whenever you issue an F$SEARCH containing a wild card, the search
  context is retained until there are no more matching files -- until
  a null string is returned -- or until a new F$SEARCH is started with
  a different file specification.
 
  If your command is executed multiple times, then the the second and
  subsequent executions will use the existing F$SEARCH context, because
  the file specifications are the same.  This can give correct, but
  misleading, results.
 
  You should ensure any old F$SEARCH contexts are cleared before
  starting a new search. For example:
 
  $ Clear=F$SEARCH("")
  $ IF F$SEARCH("DISK$DISK0:[IAPROD.SIDATA.FINAID]PGDA03BK.*") .NES. "" THEN -
      RENAME/LOG DISK$DISK0:[IAPROD.SIDATA.FINAID]PGDA03BK.* -
      DISK$DISK0:[IAPROD.SIDATA.FINAID.ARC]PGDA03BK_PROCESSED.*
 
  Please check the log file for the command procedure for errors, as well.
 
  If this is not the contextual processing within F$SEARCH, please contact
  the support center, as details of the OpenVMS Alpha release and ECO level
  will be required.
 

answer written or last revised on ( 24-NOV-2003 )

» close window