I don't know what your directory structure (is / was), but if the two databases
were not in the same directory, the while would fail because it tries to
connect to rrbyw4 while still in the concomp directory.  The following does
successfully work with the while loop:
CLS
SET NULL -0-
Set var vDbFilePath = 'f:\rb7\samples\'
DISCONNECT

SET VAR vdblist      TEXT = NULL
SET VAR vitemname    TEXT = NULL
SET VAR vcycle1   INTEGER = NULL

SET VAR vdblist = 'ConComp,RRBYW4'
SET VAR vcount  = (itemcnt(.vdblist))
SET VAR vcycle1 = 0
WHILE vcycle1 < .vcount THEN

  SET VAR vcycle1     = (.vcycle1 + 1)
  SET VAR vitemname   = NULL
  --  SET VAR vitemname   = 'ConComp'
  SET VAR vitemname   = (SSUB(.vdblist, .vcycle1))
  SET VAR voutputfile = (.vitemname + '.RLD')
  SET VAR voutputlob  = (.vitemname + '.LOB')
  SET VAR vcurrfiles  = (.vitemname + '.RB?')
  SET VAR vrenfiles   = (.vitemname + '._B?')
-- You have to get to the folder correctly
  Set var vDbFolder = (.vDbFilePath + .vItemName)
  CHDIR &vDbFolder

  CONNECT .vitemname
  set var vMsg = ('Begin Unload of ' + .vitemname)
  PAUSE 4 USING .vmsg
  OUTPUT .voutputfile
  UNLOAD ALL
  WRITE 'Return'
  OUTPUT SCREEN
  set var vMsg = ('End Unload of ' + .vitemname)
  PAUSE 4 USING .vmsg
  DISCONNECT
  PAUSE 4 USING 'Renaming Files'
  RENAME .vcurrfiles .vrenfiles
  PAUSE 4 USING 'Inputting Reload File'
 -- INPUT .voutputfile
  RUN .voutputfile
  DISCONNECT
  PAUSE 4 USING 'Deleting Files'
  DELETE .voutputfile
  DELETE .voutputlob
  DELETE .vrenfiles
  CHDIR \rb7\autorent
ENDWHILE
CLS
PAUSE 2 USING 'Done'
RETURN

Reply via email to