import java.io.*;
import java.util.Scanner;

/** Checkbook main program
 *
 * @author Duncan Buell
 *
 * written: 18 October 2007
*/
public class Main2 extends Object
{

  public static void main(String[] args)
  {

    Sub2 theSub = new Sub2();
    Scanner dataFile = null;

/*********************************************************************
* open a file as a Scanner.
*
* The main purpose of this complicated stuff is to do error checking
* so as to check that the file is in fact open as needed.
* The next version of this program will show you a cleaner way of
* dealing with file i/o by putting all the clutter of the error
* checking into a separate class.
*
*/
    try
    {
      dataFile = new Scanner(new File("theDataFile.dat"));
    }
    catch (FileNotFoundException ex)
    {
      System.out.println("ERROR opening inFile " + "theDataFile.dat");
      System.out.println(ex.getMessage());
      System.out.println("in" + System.getProperty("user.dir"));
      System.exit(1);
    }

    System.out.println("File opened, continue");

    theSub.doSub2(dataFile);

    System.out.println("File processed, terminate");

  }
} // public class Main2 extends Object

