Thanks, Mike.

Regardless of the correctness or otherwise of the directory structure and
the variables the conclusion is this:

"RUN .VarName" will work while "Input .VarName" will produce the error.

The code below worked for me. Note that the Input command is remmed out and
the Run is used. I had to change the second database because the one in the
RRBYW1 directory does not have the same name as the directory! (Discovered
once ConComp worked.)

Two questions now:

1) what is the difference between RUN and INPUT;
2) what is the difference between either of those and RELOAD?

Going back the WhatsNew for update #78 item 17 somebody took the effort to
give precise details for creating a new database in order to update some
system tables. I assumed that there was a good reason for doing so in the
way given when, on other occasions, a simple Reload has been recommended.

Having carried out those precise instructions manually for all my databases
it seemed logical to automate the process for the future. I didn't expect it
to be a major task!

Thanks for your help,
Regards,
Alastair.


CLS
CHDRV C:
CHDIR \RBTI\RBG7\SAMPLES\DATABASES
DISCONNECT
SET VAR vDBList      TEXT = NULL
SET VAR vItemName    TEXT = NULL
SET VAR vCycle1   INTEGER = NULL
SET VAR vDBList = 'ConComp,RRBYW2'
SET VAR vCount  = (ITEMCNT(.vDBList))
SET VAR vCycle1 = 0
WHILE vCycle1 < .vCount THEN
  SET VAR vCycle1     = (.vCycle1 + 1)
  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?')
  CHDIR .vItemName
  CONNECT .vItemName
  SET NULL -0-
  OUT .vOutPutFile
    UNLOAD ALL
  OUT SCREEN
  DISCONNECT
  RENAME .vCurrFiles .vRenFiles
--  INPUT .vOutPutFile
  RUN .vOutPutFile
  DISCONNECT
  DEL .vOutPutFile
  DEL .vOutPutLob
  DEL .vRenFiles
  CHDIR ..
ENDWHILE
CHDRV D:
RETURN





----- Original Message ----- 
From: "MikeB" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[email protected]>
Sent: Wednesday, January 12, 2005 12:23 AM
Subject: [RBG7-L] - Re: Fw: [RBG7-L] - Unload/Input problem (Bug #71799)
W98SE


>
> ----- Original Message ----- 
> From: "Alastair Burr" <[EMAIL PROTECTED]>
> To: "RBG7-L Mailing List" <[email protected]>
> Sent: Tuesday, January 11, 2005 6:36 PM
> Subject: [RBG7-L] - Re: Fw: [RBG7-L] - Unload/Input problem (Bug #71799)
W98SE
>
>
> > It never gets to the second database! Hence trace never showed me
whether
> > that was wrong or not but I did have a CHDIR so I would have spotted it
if
> > it were wrong.
>
> Perhaps you didn't understand that your CHDIR wouldn't work.  Your CHDIR
> .vitemname equates to CHDIR RRBYW4 while you are in the ConComp Dir at
> C:\RBG7\Samples\ConComp.  The only change I made was to the CHDIR command
and
> using RUN instead of INPUT, Plus injecting a RETURN at the end of the
OUTPUT
> containing the ReLoad Script.
>
> > Nevertheless, I'd be grateful if you could try it with the loop - only
one
> > iteration should do - and see if it fails for you.
> >
> > Regards,
> > Alastair.
> >
> >
> > ----- Original Message ----- 
> > From: "MikeB" <[EMAIL PROTECTED]>
> > To: "RBG7-L Mailing List" <[email protected]>
> > Sent: Tuesday, January 11, 2005 11:22 PM
> > Subject: [RBG7-L] - Re: Fw: [RBG7-L] - Unload/Input problem (Bug #71799)
> > W98SE
> >
> >
> > > 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