Supplement, Get-string-x method (object method), Explanation – FUJITSU J Adapter Class Generator User Manual

Page 63: Syntax, Parameter and return value

Advertising
background image

Chapter 5. Adapter Class Reference 63

• createdObject (attribute: OBJECT REFERENCE SELF)

Returns the generated object.

Supplement
When a data name is specified for initialValue, a String object as long as data item

length is generated. However, inserting X”0000” in the statement can generate a

String object shorter than data item length.

...
REPOSITORY.
CLASS J-String AS "java-lang-String"
...
WORKING-STORAGE SECTION.
01 initialValue PIC N(50).
01 aString OBJECT REFERENCE J-String.
...
PROCEDURE DIVISION.
...
MOVE NC"Two-byte-code
" TO initialValue.
INVOKE J-String "NEW-STRING-N" USING initialValue RETURNING aString. [1]
...
MOVE NC"Two-byte-code
" & X"0000" TO initialValue.
INVOKE J-String "NEW-STRING-N" USING initialValue RETURNING aString. [2]

1. A String object consisting of 50 characters with the last 47-character area

padded with blanks is generated.

2. A String object consisting of three characters is generated.

GET-STRING-X method (object method)

Explanation
This method fetches the character string from the String object as an alphanumeric

data item.
Syntax
INVOKE

anObject

"GET-STRING-X" RETURNING

stringValue

Parameter and return value
• anObject

Specifies the String object from which a character string is to be fetched.

• stringValue (attribute: PIC X ANY LENGTH)

Returns the character string fetched from the String object. If the specified data

item is shorter than the fetched character string, it is truncated. If the specified

data item is longer than the fetched character string, the trailing area is padded

with blanks.

Advertising