;BankUpload.WAS     v1.0

;*****************************************************************************
;*                                                                           *
;* BankUpload.WAS                                                            *
;* Copyright (C) 1998 Symantec                                               *
;* All rights reserved.                                                      *
;*                                                                           *
;* Written by:  Symantec ASPECT Assist                                       *
;* 04/23/98                                                                  *
;*                                                                           *                                                                             
;* This script file logs into a mainframe or other host system.  It is ideal *
;* for a bank or other financial institution. It pulls data from an INI file *
;* where information such as the logon, password, phone number, and file     *
;* transfer protocol is kept.  This allows you to edit the information       *
;* easily for multiple locations and multiple systems as desired, but does   *
;* not provide good security, as the INI file can be viewed. Please          *
;* use this script with caution.                                             *
;*                                                                           *
;* This ASPECT script is intended only as a sample of ASPECT programming.    *
;* Symantec makes no warranty of any kind, express or implied, including     *
;* without limitation, any warranties of merchantability and/or fitness      *
;* for a particular purpose.  Use of this program is at your own risk.       *
;*                                                                           *
;* Technical Support is not provided on this script.                         *                                                                          *
;*****************************************************************************



;****************************************************************************
;* Define Statements                                                        *
;****************************************************************************
#Define szProfileSource "c:\BankUpload.ini"


;****************************************************************************
;* MACRO definitions                                                        *
;****************************************************************************
proc main

   string szAcctName, szAcctPass, szFLoc, szFName
   string szBankname, szBankNumber, szTrans

   profilerd szProfileSource "Info" "AccountName"      szAcctName
   profilerd szProfileSource "Info" "AccountPassword"  szAcctPass
   profilerd szProfileSource "Info" "FileLocation"     szFLoc
   profilerd szProfileSource "Info" "FileName"         szFName
   profilerd szProfileSource "Info" "BankName"         szBankName
   profilerd szProfileSource "Info" "BankNumber"       szBankNumber
   profilerd szProfileSource "Info" "TransferProtocol" szTrans
   BankLogon  (szBankNumber, szAcctName, szAcctPass, szFLoc, szFName, szTrans)
   BankLogoff ()  
endproc 


;****************************************************************************
;* Bank Logon                                                               *
;* This procedure logs into the host computer, and uploads the file         *
;****************************************************************************
proc BankLogon
param string szBankNumber
param string szAcctName
param string szAcctPass
param string szFileLoc
param string szFileName
param string TransProt

   integer itemp
   
   dialnumber DATA szBankNumber            ;Dial Bank number
   while $DIALING                          ;Loop while dialing.
      yield
   endwhile
   pause 2
   if $CARRIER                             ;See if we're connected.
      transmit "^M"
      waitfor "ogon" 10                    ;Wait for logon prompt.
      transmit szAcctName                  ;Transmit account name.
      transmit "^M"
      waitfor "ssword" 10                  ;Wait for password prompt.
      transmit szAcctPass                  ;Transmit account password.
      transmit "^M"
      pause 1
      addfilename szFileLoc szFileName     ;Adds the file name to path.
      sendfile TransProt szFileLoc
      while iTemp == 1                     ;While file transfer is going on. 
         iTemp = $XFERSTATUS               ;Store $XFERSTATUS value in iTemp.
         yield                             ;Yield processor time.
      endwhile
      if iTemp == 2                        ;Test the value of iTemp for success
         statmsg "File successfully sent." 
      else                                 ;or failure of file transfer.
         errormsg "File transfer failed!"
      endif
   else
      errormsg "Unable to connect. Try again."
      exit
   endif
endproc


;****************************************************************************
;* Bank Logoff                                                              *
;* This procedure logs off from the bank.                                   *
;****************************************************************************
proc BankLogoff
   hangup               ; Hang up the phone line.
   pause 2
   usermsg "File Transfer Completed successfully!" 
   exit
endproc