Fujitsu J Adapter Class Generator User Manual page 27

Fujitsu user's guide j adapter class generator
Table of Contents

Advertisement

...
When the -s option or the "Option String" parameter is specified, the conversion
between the String object and the COBOL data items is not necessary since an
alphanumeric item can be specified as the String type argument and returns a value
directly.
...
REPOSITORY.
CLASS J-Date AS "java-util-Date"
CLASS J-DateFormat AS "java-text-DateFormat"
...WORKING-STORAGE SECTION
01
aDateFormat
OBJECT REFERENCE J-DateFormat.
01
aDate
OBJECT REFERENCE J-Date.
01
dateValue
PIC X(30).
...
PROCEDURE DIVISION.
...
MOVE "2000/01/01" & X"00" TO dateValue.
INVOKE aDateFormat "parse" USING dateValue RETURNING aDate.
...
INVOKE aDate "toString" RETURNING dateValue.
...
Notes:
The return value of the java.lang.String class constructor is the java.lang.String
class
When the String object method is used, the creation of the object (calling the
String constructor or calling the NEW-STRING-X method) is necessary.
To refer/set the java.lang.String type field (class variable or instance variable),
specify its size using -s option or "Option String" parameter.
When you want to handle the String type NULL object, do not use the -s option
and "Option String" parameter.
End Control of Character String
When passing a character string that is shorter than the data item length to an
ordinary adapter class, the end of string (X"00") must be set. The following example
shows that "ABC" is copied to alphanumeric item initialValue having length of 50
characters and is passed to the NEW-STRING-X method:
...
REPOSITORY.
CLASS J-String AS "java-lang-String"
...
WORKING-STORAGE SECTION.
01
initialValue
PIC X(50).
01
aString
OBJECT REFERENCE J-String.
...
PROCEDURE DIVISION.
...
MOVE "ABC" & X"00" TO initialValue.
INVOKE J-String "NEW-STRING-X" USING initialValue RETURNING aString.
Chapter 3. Developing Programs
27

Advertisement

Table of Contents
loading

Table of Contents