CobolDate (Micro Focus COBOL Java Class Library)
Keywords: com.microfocus.cobol.lang.CobolDate class

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.microfocus.cobol.lang
Class CobolDate

    java.lang.Object
      com.microfocus.cobol.lang.CobolDate

All Implemented Interfaces:
  DataType

public class CobolDate
extends Object
implements DataType

Java class for a CobolDate field

Copyright: Copyright (c) 2002-2003
Company: Micro Focus International Ltd

Since:
  Net Express 4.0, Server Express 4.0
Version:
  3.5, 2/11/03

Constructor Summary
`CobolDate()` Construct a CobolDate using the current time and default encoding
`CobolDate(Date sqlDate)` Construct a CobolDate type with a given date and the default encoding
`CobolDate(Date sqlDate, String encoding)` Construct a CobolDate type with a given date and a given encoding

Method Summary
`byte[]` | `getBytes()` getBytes() public method to return bytes[] representation of a CobolDate field
`String` | `getEncoding()` get the current encoding
`void` | `synchronizeData()` public method called by the COBOL Runtime to allow the CobolDate instance to update its Java represenation of the CobolDate field.
`String` | `toString()` returns a String representation of the CobolDate

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CobolDate

    public CobolDate()

  Construct a CobolDate using the current time and default encoding

### CobolDate

    public CobolDate(Date sqlDate)

  Construct a CobolDate type with a given date and the default encoding

       long milliseconds  = System.currentTimeMillis();
       CobolDate sqlDate= new CobolDate(new Date(milliseconds));

       RuntimSystem.cobcall("showdate",ParameterList().add(sqlDate));

       and showdate.cbl is:

       working-storage section.
       linkage section.
       01 jsql-date.
       03 jyear     pic 9(4).
       03 filler    pic x.
       03 jmonth    pic 99.
       03 filler    pic x.
       03 jday      pic 99.
       procedure division using jsql-date.
       display "COBOL -> " jsql-date.
       add 100 to jyear
       exit program returning 0.
       *

Parameters:
  `sqlDate` - a java.sql.Date

### CobolDate

    public CobolDate(Date sqlDate,
                     String encoding)
              throws UnsupportedEncodingException

  Construct a CobolDate type with a given date and a given encoding

       long milliseconds  = System.currentTimeMillis();
       CobolDate sqlDate= new CobolDate(new Date(milliseconds),,"Cp500"));

       RuntimSystem.cobcall("showdate",ParameterList().add(sqlDate));

       and showdate.cbl is:

       $set charset(ebcdic) initcall(utils)
       working-storage section.
       linkage section.
       01 jsql-date.
       03 jyear     pic 9(4).
       03 filler    pic x.
       03 jmonth    pic 99.
       03 filler    pic x.
       03 jday      pic 99.
       procedure division using jsql-date.
       display "COBOL -> " jsql-date.
       add 100 to jyear
       exit program returning 0.
       *

  Note: Cp500 is java code page, so it may not contain all european ebcdic characters

Parameters:
  `sqlDate` - a java.sql.Date
  `encoding` - a valid encoding
Throws:
  `UnsupportedEncodingException`

Method Detail

### getBytes

    public byte[] getBytes()
                    throws CobolException,
                           Exception

  getBytes() public method to return bytes[] representation of a CobolDate field

  Specified by:
    `getBytes` in interface `DataType`
  Returns:
    a byte[]
  Throws:
    `CobolException`
    `Exception`

### synchronizeData

    public void synchronizeData()
                         throws CobolException,
                                Exception

  public method called by the COBOL Runtime to allow the CobolDate instance to update its Java represenation of the CobolDate field.

  Specified by:
    `synchronizeData` in interface `DataType`
  Throws:
    `CobolException`
    `Exception`

### getEncoding

    public String getEncoding()

  get the current encoding

  Returns:
    a string

### toString

    public String toString()

  returns a String representation of the CobolDate

  Returns:
    a string

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ? 2000 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.