I need to create safearray (to pass it into COM object outside Cobol), and each item in this safearray must be PIC N string.
I am using this code:
05 w-hostArray object reference.
05 w-listA.
10 w-item pic n(500) occurs 8.
......
move VT-BSTR to w-vartype
move 1 to w-dimension
move xx-z to cElements of w-saBound(1)
move 0 to llBound of w-saBound(1)
invoke OLESafeArray "new" using by value w-vartype
w-dimension
by reference w-saBound(1)
returning w-hostArray
end-invoke
perform varying w-Index from 0 by 1 until w-Index >= xx-z
invoke w-hostArray "putString"
using by reference w-Index
by value 100
by reference w-item(w-Index + 1)
returning w-hresult
end-invoke
end-perform
Where w-item is PIC N(500). But it's not working, on the other side in C#, I receive in string variable complete gibberish. I think that "putString" accepts only PIC X.
So how to create safearray with Unicode strings?