Skip to main content

We are in a situation where we need to pass Java string values to a COBOL program using the implementation of javax.resource.cci.Interaction and trying to solve the problem with the string values returned in the javax.resource.cci.IndexedRecord, specified as the oRec (which is the third parameter) parameter to javax.resource.cci.Interaction.execute(InteractionSpec spec, Record iRec, Record oRec), gets garbled. 

When passing a string value, it is wrapped in as new Pointer(string_value, "MS932") to match the encoding used in the COBOL environment, which is set to SJIS at OS level. This string is assigned to PIC X field within the COBOL program when  Interaction.execute is invoked. 

As long as the value assigned to the PIC field is intact, meaning no string concatenation or whatsoever is performed, no gabling occurs. However, string concatenation is performed and the result is assigned back to the same field, characters such as ㎡ symbols returned in the IndexedRecord is garbled.

This is probably occurring due to the character set missmatch.

My question is how is string encoding/decoding is handled when it travels from Java to Cobol, and the vice versa. 

Thank you in advance.