FAQ > PERCobol and Java > How can I....

Search the FAQ for entries containing:

If I have the following definitions in my working storage:
01 string1 pic x(80).
01 string2 object reference "java.lang.String".

How can I get the value from string1 into string2? I can go the opposite way
(move string2 to string1), but nothing I've tried seems to want to let me move
string1 into string2.

ANSWER:
Objects are generally manipulated using INVOKE and SET rather than
MOVE, for example:
invoke string2 using by value string1 giving string2

The above statement creates a java.lang.String object using the value of
string1. The 'giving' points the object reference 'string2' to reference the new
string object.

Last updated on December 28, 2009 by Daniel Myers