! CONNECT.TXT   Version 1.0

This file describes the variables that must be set to use the standard
Ozterm Connect and Disconnect script files to automatically connect and
disconnect from exchnage sessions.

This assumes that:
* LOCAL.DAT is configured correctly to locate the files required in the 
  appropriate directories; and
* The Exchange Selection files have been setup correctly.

The following variables are set to use Connect.cmd and Disconnt.cmd in 
'Automatic' mode:

LNCD = Exchange Location Code where "Exchange Location Code" is the Exchange 
       code stored in the Exchange Selection file, eg EXJU.

FINISHED = 'HIDE'   to return from the connect and disconnect script files to 
                    the parent script file instead of stopping.

AUTOFILE = 'YES'  to indicate to the script files not to prompt the user for 
                  any input.


The two variables to check for successful connection are:

CON_FLAG indicates whether the session successfully connected to the site, ie 
set to CONNOK if successful.

LRDERROR is set to FAIL if the LNCD code nominated was not found in the 
Exchange Selection file.


Below is a sample script file for automatically connecting to a list of sites
and performing a function on each site.  This assumes as list of sites has 
been read into an array of variables from lrd1 to lrd{N}, and the last LNCD 
set is END.

-----------------------------------------------------------------------------
@include('LOCAL.DAT')

@label nextexch
! Ensure the CONNECT and DISCONNT script files return to the parent script file.
  @set FINISHED = "HIDE"

! Disconnect session from the previous site
  @include(concat(DIR0,'disconnt.cmd'))

  @inc(node)
! Set LNCD to the next site name (must be upper case), eg 'EXJU'
  @set lncd = lrd{node}

! Use LNCD of END to indicate the last site has been processed
  @if lncd = 'END' then goto END_SCRIPT

! Ensure the connect script file will not prompt the user for information
  @set AUTOFILE = 'YES'

! Reset error flags
  @set CON_FLAG = ''
  @set LRDERROR = ''

! Call the Connect script file
  @include(concat(DIR0,'connect.cmd'))

! Check for successful connection and process accordingly
! CON_FLAG set to indicate if the connection attempt was successful or not.
! LRDERROR set to FAIL if the LNCD was not found in the Exchange Selection file.
  @if ((LRDERROR = 'FAIL') OR (CON_FLAG <> 'CONNOK')) then gosub con_fail
  @if ((LRDERROR = 'FAIL') OR (CON_FLAG <> 'CONNOK')) then goto nextexch

!  Perform the required routines
 @gosub routines

! Go to the next exchange
@goto nextexch

@label routines
  @@enter command
  @@analyse result
  @@store result
@return

@Label End_script
  @comment('Finished')
@stop
