Previous Topic Next topic Print topic


Strings in JVM COBOL Interoperation

In JVM COBOL, the String and type java.lang.String are identical, as in the following example:

 01 s String value "hello".
 01 s type java.lang.String value "hello".

When you pass strings from JVM COBOL to native code, we recommend that you pass them indirectly as pic x. For example:

 01 s String value "hello". 
 01 toSend pic x(1024). 
 01 sayer-ptr procedure-pointer.
 . . . 
  move s to toSend 
  set sayer-ptr to entry "sayer"
 call "say" using by reference toSend

You must ensure that the passed data is zero terminated if you are calling using the C string convention.

Previous Topic Next topic Print topic