This article explains whether a 2 byte field cannot be stored in a single byte field.
Problem:
When Shift_JIS strings are passed to a COBOL Service via the Java Connector to a PIC X(..) field it is passed as ?. Is this because a 2 byte field cannot be stored in a single byte field?
Resolution:
The issue here is that a 2 byte UNICODE character is being passed to a single byte PIC X field. During this conversion all the Shift_JIS characters get converted to 63 "?". Hence returning the string will not give the same results as the original string in Java. In order to pass the Shift_JIS correctly to the server process you need to have the linkage fields in the server module in a format suitable to contain Shift_JIS.
For example, the module:
working-storage section.
01 ws-data pic x(8) value "HELLO123".
linkage section.
01 lnk-input pic X(8).
01 lnk-output pic X(8).
procedure division using lnk-input lnk-output.
start-section.
call "cbl_debugbreak"
if lnk-input = "01234567"
move ws-data to lnk-output
else
move lnk-input to lnk-output
end-if
goback.
Did not return a matching string to the Java. In order to pass the shiftjis string you can change the linkage to:
01 lnk-input pic N(8).
01 lnk-output pic N(8).
And compiled using nsymbol (national) directive. This declared the fields as UNICODE. When declated as UNICODE the string returned is equal to the string passed in when checked in the Java.
#netexpress
#Enterprise
#Server
#COBOL
#EnterpriseServer