     /****************************************************************
      * Copyright (C) 1996 - 2001 Micro Focus International Ltd.     *
      * All Rights Reserved.                                         *
      ****************************************************************/

import com.microfocus.cobol.*;

public class RecordDemo
{
    public RecordDemo()
    {
    }

    public void setDetails(RecordData customerDetails) throws CobolException, Exception
    {
       int retcode;

       // pass the details to the COBOL program
       Object[] params = { customerDetails};
       try 
       {
           retcode = RuntimeSystem.cobcall("RecordDemo", params);
       }
       catch (Exception e)
       {
	   System.exit(0);
       }
    }

    static void main(String args[])
    {
       // Create the class which calls COBOL
       RecordDemo rd = new RecordDemo();

       // Create the structure to pass
       RecordData customerDetails = new RecordData("Micro Focus", "Newbury", 123456);
       
       // Show data before setDetails()
       System.out.print("Record before setDetails\n"+customerDetails.toString()+"\n\n");
       // pass the details to the RecordDemo object
       try 
       {
           rd.setDetails(customerDetails);
       }
       catch (Exception e)
       {
	   e.printStackTrace();
	   System.exit(0);
       }
       
       // Show the updated details. 
       customerDetails.showRef();
    }
}

