[SOLVED] Set a specific Unicode Field
Posted: Tue Jul 25, 2017 12:56 am
Does anyone know how to set a Unicode Field to a specific value in RDMLX code?
1. I do not want to read a Unicode database field from a table and move that value in, I want to set an arbitrary Unicode value like u+nnnn and cast it into a Unicode file.
2. .asSQLNativeString moves a given unicode value into a native code page (not what we want)
3. .asSQLHexLiteral is to prepare a unicode value for use in a select_sql statement
4. You can move a field in a native code page into a Unicode field easily enough, but that is not the same thing as #1
This code works =>
Define Field(#W_DESCRIPTION) Type(*NVARCHAR) Length(70) Desc('Description')
Define Field(#wknbsp) Type(*char) Length(2)
Use Builtin(HEXTOBIN) With_Args('A000') To_Get(#wknbsp)
#W_DESCRIPTION := *blanks + #wknbsp
However it is platform specific in that the little endian, big endian nature of the platform comes into play.
On windows to make this work (this is a non-breaking space) you need to us A000, on IBMi you need to use 00A0.
Questions.
1. Is there a language builtin to do this in RDMLX code?
2. If there is not, should there be?
1. I do not want to read a Unicode database field from a table and move that value in, I want to set an arbitrary Unicode value like u+nnnn and cast it into a Unicode file.
2. .asSQLNativeString moves a given unicode value into a native code page (not what we want)
3. .asSQLHexLiteral is to prepare a unicode value for use in a select_sql statement
4. You can move a field in a native code page into a Unicode field easily enough, but that is not the same thing as #1
This code works =>
Define Field(#W_DESCRIPTION) Type(*NVARCHAR) Length(70) Desc('Description')
Define Field(#wknbsp) Type(*char) Length(2)
Use Builtin(HEXTOBIN) With_Args('A000') To_Get(#wknbsp)
#W_DESCRIPTION := *blanks + #wknbsp
However it is platform specific in that the little endian, big endian nature of the platform comes into play.
On windows to make this work (this is a non-breaking space) you need to us A000, on IBMi you need to use 00A0.
Questions.
1. Is there a language builtin to do this in RDMLX code?
2. If there is not, should there be?