com.microfocus.cobol.lang
Class Comp3

java.lang.Object
  extended bycom.microfocus.cobol.lang.Comp3
All Implemented Interfaces:
DataType

public class Comp3
extends Object
implements DataType

Java class for COMP-3 datatype

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

Since:
Net Express 4.0, Server Express 4.0
Version:
3.12, 2/4/03

Constructor Summary
Comp3(BigDecimal value, int padSize)
          Constructor for a signed comp-3 item with a defined picture size from a BigDecimal with a scale

Example:
Comp3(BigDecimal value, int pictureSize, boolean signed)
          Constructor for a signed/unsigned comp-3 item with a defined picture size from a BigDecimal with a scale

Example:
Comp3(BigInteger value, int pictureSize)
          Constructor for a signed comp-3 item with a defined picture size
Comp3(BigInteger value, int pictureSize, boolean signed)
          Constructor for a signed/unsigned comp-3 item with a defined picture size

Example:
Comp3(String value, int pictureSize)
          Constructor for a signed comp-3 item with a defined picture size

Example:
Comp3(String value, int pictureSize, boolean signed)
          Constructor for a signed/unsigned comp-3 item with a defined picture size

Example:
Comp3(String value, int pictureSize, int decimalPlaces)
          Constructor for a signed comp-3 item with a defined picture size from a string with a picture size

Example:
 
Method Summary
 byte[] getBytes()
          getBytes() public method to return bytes[] representation of a comp-3 field
 void synchronizeData()
          synchronizeData() public method called by the COBOL Runtime to allow the comp-3 to update its Java represenation of the comp-3 field.
 String toDisplayFormat()
          method to return the display format string of a Comp3
 String toString()
          toString() method to return a Comp3 as a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Comp3

public Comp3(BigInteger value,
             int pictureSize)
Constructor for a signed comp-3 item with a defined picture size

Parameters:
value - BigInteger value
pictureSize - sizeof picture clause
Example:
 The Java code that defines a :  pic s9(8) comp-3 with a value of 12345678

 comp31 = new Comp3(new BigInteger("12345678"), 8);

 To display the field you can do:
 System.out.println("comp31.toString() = " + comp31.toString());

 

Comp3

public Comp3(BigDecimal value,
             int padSize)
Constructor for a signed comp-3 item with a defined picture size from a BigDecimal with a scale

Example:
 The Java code that defines a :  pic s9(4)v9(4) comp-3 with a assumed
 value of 1234.5678

 BigDecimal scale4a = new BigDecimal(new BigInteger("12345678"), 4);
 comp31 = new Comp3(scale4a, 8);

 To display the field you can do:
 System.out.println("scale4a.toString()        = " + comp31.toString());
 System.out.println("scale4a.toDisplayFormat() = " + comp31.toDisplayFormat());
 

Parameters:
value -
padSize -

Comp3

public Comp3(String value,
             int pictureSize,
             int decimalPlaces)
Constructor for a signed comp-3 item with a defined picture size from a string with a picture size

Example:
 The Java code that defines a :  pic s9(4)v9(5) comp-3 with a assumed
 value of 1234.56789

 comp31 = new Comp3("1234.56789",9,5);

 To display the field you can do:
 System.out.println("scale4a.toString()        = " + comp31.toString());
 System.out.println("scale4a.toDisplayFormat() = " + comp31.toDisplayFormat());
 

Parameters:
value -
pictureSize -
decimalPlaces -

Comp3

public Comp3(String value,
             int pictureSize)
Constructor for a signed comp-3 item with a defined picture size

Example:
 The Java code that defines a :  pic s9(8) comp-3 with a value of 12345678

 comp31 = new Comp3("12345678", 8);

 To display the field you can do:
 System.out.println("comp31.toString() = " + comp31.toString());
 

Parameters:
value -
pictureSize -

Comp3

public Comp3(String value,
             int pictureSize,
             boolean signed)
Constructor for a signed/unsigned comp-3 item with a defined picture size

Example:
 The Java code that defines a :  pic 9(8) comp-3 with a value of 12345678

 comp31 = new Comp3("12345678", 8, false);

 To display the field you can do:
 System.out.println("comp31.toString() = " + comp31.toString());
 

Parameters:
value -
pictureSize -
signed -

Comp3

public Comp3(BigInteger value,
             int pictureSize,
             boolean signed)
Constructor for a signed/unsigned comp-3 item with a defined picture size

Example:
 The Java code that defines a :  pic s9(8) comp-3 with a value of 12345678

 comp31 = new Comp3(new BigInteger("12345678"), 8, true);

 To display the field you can do:
 System.out.println("comp31.toString() = " + comp31.toString());

 

Parameters:
value -
pictureSize -
signed -

Comp3

public Comp3(BigDecimal value,
             int pictureSize,
             boolean signed)
Constructor for a signed/unsigned comp-3 item with a defined picture size from a BigDecimal with a scale

Example:
 The Java code that defines a :  pic s9(4)v9(4) comp-3 with a assumed
 value of 1234.5678

 BigDecimal scale4a = new BigDecimal(new BigInteger("12345678"), 4);
 comp31 = new Comp3(scale4a, 8, true);

 To display the field you can do:
 System.out.println("scale4a.toString()        = " + comp31.toString());
 System.out.println("scale4a.toDisplayFormat() = " + comp31.toDisplayFormat());
 

Parameters:
value -
pictureSize -
signed -
Method Detail

getBytes

public byte[] getBytes()
getBytes() public method to return bytes[] representation of a comp-3 field

Specified by:
getBytes in interface DataType
Returns:
a byte[]

synchronizeData

public void synchronizeData()
                     throws Exception
synchronizeData() public method called by the COBOL Runtime to allow the comp-3 to update its Java represenation of the comp-3 field.

Specified by:
synchronizeData in interface DataType
Throws:
Exception

toDisplayFormat

public String toDisplayFormat()
method to return the display format string of a Comp3

Returns:
display format String

toString

public String toString()
toString() method to return a Comp3 as a String

Returns:
String



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