CobolNational (Micro Focus COBOL Java Class Library)
Keywords: com.microfocus.cobol.lang.CobolNational 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 CobolNational

    java.lang.Object
      com.microfocus.cobol.lang.CobolNational

All Implemented Interfaces:
  DataType

public class CobolNational
extends Object
implements DataType

Java class for COBOL National fields (PIC N(..) usage is national)

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

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

Constructor Summary
`CobolNational(StringBuffer stringbuffer)` Construct a Cobol National field with a StringBuffer and a fixed length of the StringBuffers capacity.
`CobolNational(StringBuffer stringbuffer, int length)` Construct a Cobol National field with a StringBuffer and a given fixed length.
`CobolNational(String string, int length)` Construct a Cobol National field with a String and a fixed length
`CobolNational(String string, int length, String encoding)` Construct a Cobol National field with a String, a fixed length and an encoding.
`CobolNational(String string, int length, String encoding, char filler)` Construct a fixed length Cobol National field by using a string and filling out the end of string with the given filler character and encoding it in one of the following valid encodings: UTF16, UTF-16BE, UTF-16LE.

Method Summary
`byte[]` | `getBytes()` get the byte[] of a Cobol National field
`void` | `synchronizeData()` called by runtime when the CobolNational field (this.nationalBytes) is changed
`String` | `toString()` Converts a CobolNational field into a String

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

Constructor Detail

### CobolNational

    public CobolNational(String string,
                         int length,
                         String encoding,
                         char filler)
                  throws UnsupportedEncodingException

  Construct a fixed length Cobol National field by using a string and filling out the end of string with the given filler character and encoding it in one of the following valid encodings: UTF16, UTF-16BE, UTF-16LE.

  If the default encoding of UTF-16 is used then the COBOL programs must be compiled with the "unicode(portable)" directive.

  If COBOL programs are compiled with "unicode(native)" then the encoding you must use is platform dependent. The choice you have is UTF-16BE or UTF-16LE.

  The Microsoft Windows platforms use UTF-16LE.

  Example: passing a string that contains "Hello From Java" to a "pic n(40) usage is national" in the program hellonat.

  COBOL program:

       $set unicode(portable)
        working-storage section.
        linkage section.
        01 lnk-natstring   pic n(40) usage is national.
        procedure division using lnk-natstring.
            display "Java said to COBOL [" lnk-natstring "]"
            move "Hello to Java" to lnk-natstring
            exit program returning 0.

  Sample Java code to call the COBOL program.

        CobolNational cobnat = new CobolNational("Hello From Java", 40);
        RuntimeSystem.cobcall("hellonat", new ParameterList().add(cobnat));
        System.out.println(cobnat.toString());

Parameters:
  `string` -
  `length` -
  `encoding` -
  `filler` -
Throws:
  `UnsupportedEncodingException`

### CobolNational

    public CobolNational(String string,
                         int length,
                         String encoding)
                  throws UnsupportedEncodingException

  Construct a Cobol National field with a String, a fixed length and an encoding.

Parameters:
  `string` -
  `length` -
  `encoding` -
Throws:
  `UnsupportedEncodingException`

### CobolNational

    public CobolNational(String string,
                         int length)

  Construct a Cobol National field with a String and a fixed length

Parameters:
  `string` -
  `length` -

### CobolNational

    public CobolNational(StringBuffer stringbuffer)

  Construct a Cobol National field with a StringBuffer and a fixed length of the StringBuffers capacity.

Parameters:
  `stringbuffer` -

### CobolNational

    public CobolNational(StringBuffer stringbuffer,
                         int length)

  Construct a Cobol National field with a StringBuffer and a given fixed length.

Parameters:
  `stringbuffer` -
  `length` -

Method Detail

### getBytes

    public byte[] getBytes()
                    throws CobolException,
                           Exception

  get the byte[] of a Cobol National field

  Specified by:
    `getBytes` in interface `DataType`
  Returns:
  Throws:
    `CobolException`
    `Exception`

### synchronizeData

    public void synchronizeData()
                         throws CobolException,
                                Exception

  called by runtime when the CobolNational field (this.nationalBytes) is changed

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

### toString

    public String toString()

  Converts a CobolNational field into a String

  Returns:
    a String representing the CobolNational 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.