|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.microfocus.cobol.lang.CobolNational
Java class for COBOL National fields (PIC N(..) usage is national)
Copyright: Copyright (c) 2002-2003
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 |
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());
string
- length
- encoding
- filler
-
UnsupportedEncodingException
public CobolNational(String string, int length, String encoding) throws UnsupportedEncodingException
string
- length
- encoding
-
UnsupportedEncodingException
public CobolNational(String string, int length)
string
- length
- public CobolNational(StringBuffer stringbuffer)
stringbuffer
- public CobolNational(StringBuffer stringbuffer, int length)
stringbuffer
- length
- Method Detail |
public byte[] getBytes() throws CobolException, Exception
getBytes
in interface DataType
CobolException
Exception
public void synchronizeData() throws CobolException, Exception
synchronizeData
in interface DataType
CobolException
Exception
public String toString()
|
|||||||||||
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.